From ed43cbaf96c89d13675d2afeb8c73109982c64d9 Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Sun, 18 Aug 2002 00:24:25 +0000 Subject: Fix broken locking so that at least the Python 2.2.1 grp test doesn't lock up. This really needs to be looked at, as I don't think this needs to be reentrant. In any case, several routines call the __getgrent internal routine and it uses static vars for data. If this stuff is really supposed to be threadsafe, then __getgrent probably needs fixing. --- libc/pwd_grp/grent.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libc') diff --git a/libc/pwd_grp/grent.c b/libc/pwd_grp/grent.c index f867a1aaf..5ebcf265c 100644 --- a/libc/pwd_grp/grent.c +++ b/libc/pwd_grp/grent.c @@ -62,9 +62,14 @@ void endgrent(void) struct group *getgrent(void) { + struct group *r; + LOCK; - if (grp_fd == -1) + if (grp_fd == -1) { + UNLOCK; return NULL; - return __getgrent(grp_fd); + } + r = __getgrent(grp_fd); UNLOCK; + return r; } -- cgit v1.2.3