Return EINVAL when calling pthread_detach for joined thread.

Change-Id: I717015132187e087e0ad485284a13c8801e25e77
diff --git a/libc/bionic/pthread_detach.cpp b/libc/bionic/pthread_detach.cpp
index 9f957f4..dcdb7b1 100644
--- a/libc/bionic/pthread_detach.cpp
+++ b/libc/bionic/pthread_detach.cpp
@@ -44,7 +44,7 @@
     }
     switch (old_state) {
       case THREAD_NOT_JOINED: return 0;
-      case THREAD_JOINED:     return 0;  // Already being joined; silently do nothing, like glibc.
+      case THREAD_JOINED:     return EINVAL;
       case THREAD_DETACHED:   return EINVAL;
       case THREAD_EXITED_NOT_JOINED: break;  // Call pthread_join out of scope of pthread_accessor.
     }