Fix class_linker_test.

ClassLinker::FindClass now requires the calling thread to be attached. Also
improve the error reporting in Thread::Attach.

Change-Id: I95bae22288902a8c19a99c14ad66f3dbcca4a0b6
diff --git a/src/thread.cc b/src/thread.cc
index 40a3f0e..a3899c7 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -95,8 +95,11 @@
 
   thread->state_ = kRunnable;
 
-  int result = pthread_setspecific(Thread::pthread_key_self_, thread);
-  CHECK_EQ(result, 0);
+  errno = pthread_setspecific(Thread::pthread_key_self_, thread);
+  if (errno != 0) {
+      PLOG(FATAL) << "pthread_setspecific failed";
+  }
+
   return thread;
 }