about summary refs log tree commit diff
path: root/nscd/pwdcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'nscd/pwdcache.c')
-rw-r--r--nscd/pwdcache.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c
index a3676666da..82a26efc25 100644
--- a/nscd/pwdcache.c
+++ b/nscd/pwdcache.c
@@ -103,6 +103,7 @@ set_neg_pwd_ttl (unsigned long int ttl)
 int
 cache_pwdinit ()
 {
+  pthread_attr_t attr;
   pthread_t thread;
 
   pwdtbl = calloc (modulo, sizeof (pwdhash));
@@ -115,10 +116,14 @@ cache_pwdinit ()
   if (negtbl == NULL)
     return -1;
 
-  pthread_create (&thread, NULL, pwdtable_update, (void *)NULL);
-  pthread_detach (thread);
-  pthread_create (&thread, NULL, negtable_update, (void *)NULL);
-  pthread_detach (thread);
+  pthread_attr_init (&attr);
+  pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
+
+  pthread_create (&thread, NULL, pwdtable_update, &attr);
+  pthread_create (&thread, NULL, negtable_update, &attr);
+
+  pthread_attr_destroy (&attr);
+
   return 0;
 }