about summary refs log tree commit diff
path: root/nptl/pthread_setspecific.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/pthread_setspecific.c')
-rw-r--r--nptl/pthread_setspecific.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/nptl/pthread_setspecific.c b/nptl/pthread_setspecific.c
index baca804adb..b6e66b5f22 100644
--- a/nptl/pthread_setspecific.c
+++ b/nptl/pthread_setspecific.c
@@ -45,6 +45,10 @@ __pthread_setspecific (key, value)
 	return EINVAL;
 
       level2 = &self->specific_1stblock[key];
+
+      /* Remember that we stored at least one set of data.  */
+      if (value != NULL)
+	THREAD_SETMEM (self, specific_used, true);
     }
   else
     {
@@ -76,6 +80,9 @@ __pthread_setspecific (key, value)
 
       /* Pointer to the right array element.  */
       level2 = &level2[idx2nd];
+
+      /* Remember that we stored at least one set of data.  */
+      THREAD_SETMEM (self, specific_used, true);
     }
 
   /* Store the data and the sequence number so that we can recognize
@@ -83,9 +90,6 @@ __pthread_setspecific (key, value)
   level2->seq = seq;
   level2->data = (void *) value;
 
-  /* Remember that we stored at least one set of data.  */
-  THREAD_SETMEM (self, specific_used, true);
-
   return 0;
 }
 strong_alias (__pthread_setspecific, pthread_setspecific)