summaryrefslogtreecommitdiff
path: root/tsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'tsd.c')
-rw-r--r--tsd.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/tsd.c b/tsd.c
index f8656ce..5183cd7 100644
--- a/tsd.c
+++ b/tsd.c
@@ -25,11 +25,11 @@
#include "pthread.h"
#include "implement.h"
-
-/* TLS_OUT_OF_INDEXES not defined on WinCE */
-#ifndef TLS_OUT_OF_INDEXES
-#define TLS_OUT_OF_INDEXES 0xffffffff
-#endif
+
+/* TLS_OUT_OF_INDEXES not defined on WinCE */
+#ifndef TLS_OUT_OF_INDEXES
+#define TLS_OUT_OF_INDEXES 0xffffffff
+#endif
int
pthread_key_create (pthread_key_t * key, void (*destructor) (void *))
@@ -212,6 +212,7 @@ pthread_setspecific (pthread_key_t key, const void *value)
* ENOSPC a required resource has been exhausted,
* ENOSYS semaphores are not supported,
* EPERM the process lacks appropriate privilege
+ * ENOENT the thread couldn't find it's own handle
*
* ------------------------------------------------------
*/
@@ -227,6 +228,10 @@ pthread_setspecific (pthread_key_t key, const void *value)
* thread if one wasn't explicitly created
*/
self = pthread_self ();
+ if (self == NULL)
+ {
+ return ENOENT;
+ }
}
else
{