summaryrefslogtreecommitdiff
path: root/libc/pwd_grp/grent.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2002-08-18 00:24:25 +0000
committerManuel Novoa III <mjn3@codepoet.org>2002-08-18 00:24:25 +0000
commited43cbaf96c89d13675d2afeb8c73109982c64d9 (patch)
treee4b09796fc7bc67dbe38c30fbcb7c5b1c0b39882 /libc/pwd_grp/grent.c
parent43b3eaffd907f6a66476fe605698ee3bdd5280bc (diff)
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.
Diffstat (limited to 'libc/pwd_grp/grent.c')
-rw-r--r--libc/pwd_grp/grent.c9
1 files changed, 7 insertions, 2 deletions
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;
}