uwrap: Add mutex in uwrap_destructor().
authorAndreas Schneider <asn@samba.org>
Thu, 31 Jul 2014 08:13:10 +0000 (10:13 +0200)
committerMichael Adam <obnox@samba.org>
Thu, 31 Jul 2014 16:49:47 +0000 (18:49 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
lib/uid_wrapper/uid_wrapper.c

index 742903a11d788db745b1a4ed192edb6180b2db63..b77aa023ece86f9240bfa6808ef22ed0d193d099 100644 (file)
@@ -1162,6 +1162,7 @@ void uwrap_destructor(void)
 {
        struct uwrap_thread *u = uwrap.ids;
 
+       pthread_mutex_lock(&uwrap_id_mutex);
        while (u != NULL) {
                UWRAP_DLIST_REMOVE(uwrap.ids, u);
 
@@ -1170,6 +1171,7 @@ void uwrap_destructor(void)
 
                u = uwrap.ids;
        }
+       pthread_mutex_unlock(&uwrap_id_mutex);
 
        if (uwrap.libc.handle != NULL) {
                dlclose(uwrap.libc.handle);