summary refs log tree commit diff
path: root/linuxthreads/specific.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-12-14 07:02:23 +0000
committerUlrich Drepper <drepper@redhat.com>2001-12-14 07:02:23 +0000
commit9b63f5b4fae14e1636517550d45f453439cbaac6 (patch)
treef10a1481608750ae76d4628de74aeb3e7e8bc1ea /linuxthreads/specific.c
parent0838e0b9265a9ec55d1a11fa3f32616ec7dbf74c (diff)
downloadglibc-9b63f5b4fae14e1636517550d45f453439cbaac6.tar.gz
glibc-9b63f5b4fae14e1636517550d45f453439cbaac6.tar.xz
glibc-9b63f5b4fae14e1636517550d45f453439cbaac6.zip
Update.
2001-12-13  Thorsten Kukuk  <kukuk@suse.de>

	* sysdeps/posix/cuserid.c (cuserid): If we don't find the UID,
	but have a user supplied buffer, return the empty buffer, not NULL.
Diffstat (limited to 'linuxthreads/specific.c')
-rw-r--r--linuxthreads/specific.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/linuxthreads/specific.c b/linuxthreads/specific.c
index 1a0cab10b6..2dbf2055e5 100644
--- a/linuxthreads/specific.c
+++ b/linuxthreads/specific.c
@@ -102,25 +102,28 @@ int pthread_key_delete(pthread_key_t key)
 
   /* Set the value of the key to NULL in all running threads, so
      that if the key is reallocated later by pthread_key_create, its
-     associated values will be NULL in all threads. */
+     associated values will be NULL in all threads.
 
-  {
-    struct pthread_key_delete_helper_args args;
-    struct pthread_request request;
+     Do nothing if no threads have been created yet.  */
 
-    args.idx1st = key / PTHREAD_KEY_2NDLEVEL_SIZE;
-    args.idx2nd = key % PTHREAD_KEY_2NDLEVEL_SIZE;
-    args.self = 0;
+  if (__pthread_manager_request != -1)
+    {
+      struct pthread_key_delete_helper_args args;
+      struct pthread_request request;
 
-    request.req_thread = self;
-    request.req_kind = REQ_FOR_EACH_THREAD;
-    request.req_args.for_each.arg = &args;
-    request.req_args.for_each.fn = pthread_key_delete_helper;
+      args.idx1st = key / PTHREAD_KEY_2NDLEVEL_SIZE;
+      args.idx2nd = key % PTHREAD_KEY_2NDLEVEL_SIZE;
+      args.self = 0;
 
-    TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
-				    (char *) &request, sizeof(request)));
-    suspend(self);
-  }
+      request.req_thread = self;
+      request.req_kind = REQ_FOR_EACH_THREAD;
+      request.req_args.for_each.arg = &args;
+      request.req_args.for_each.fn = pthread_key_delete_helper;
+
+      TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request,
+				      (char *) &request, sizeof(request)));
+      suspend(self);
+    }
 
   pthread_mutex_unlock(&pthread_keys_mutex);
   return 0;