summaryrefslogtreecommitdiff
path: root/libc/pwd_grp/fgetgrent.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-09-10 05:53:30 +0000
committerEric Andersen <andersen@codepoet.org>2002-09-10 05:53:30 +0000
commit431fc6465d32db324360e947bb55cf972e85cf84 (patch)
tree48f6b77281a4d10e929ad35c075e54464ebe7785 /libc/pwd_grp/fgetgrent.c
parentbee4f83a21cf7ca9937f7c69020cd44e076c9591 (diff)
Fix some locking problems noted by Manuel. __getgrent() was always
called under lock, but the callers did not share the same locks... -Erik
Diffstat (limited to 'libc/pwd_grp/fgetgrent.c')
-rw-r--r--libc/pwd_grp/fgetgrent.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libc/pwd_grp/fgetgrent.c b/libc/pwd_grp/fgetgrent.c
index b99df1c77..2c7917601 100644
--- a/libc/pwd_grp/fgetgrent.c
+++ b/libc/pwd_grp/fgetgrent.c
@@ -24,13 +24,14 @@
#ifdef __UCLIBC_HAS_THREADS__
#include <pthread.h>
-static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER;
-# define LOCK pthread_mutex_lock(&mylock)
-# define UNLOCK pthread_mutex_unlock(&mylock);
+extern pthread_mutex_t __getgrent_lock;
+# define LOCK pthread_mutex_lock(&__getgrent_lock)
+# define UNLOCK pthread_mutex_unlock(&__getgrent_lock);
#else
# define LOCK
# define UNLOCK
#endif
+
static char *line_buff = NULL;
static char **members = NULL;