Browse Source

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.

Manuel Novoa III 23 years ago
parent
commit
ed43cbaf96
1 changed files with 7 additions and 2 deletions
  1. 7 2
      libc/pwd_grp/grent.c

+ 7 - 2
libc/pwd_grp/grent.c

@@ -62,9 +62,14 @@ void endgrent(void)
 
 
 struct group *getgrent(void)
 struct group *getgrent(void)
 {
 {
+    struct group *r;
+
     LOCK;
     LOCK;
-    if (grp_fd == -1)
+    if (grp_fd == -1) {
+	UNLOCK;
 	return NULL;
 	return NULL;
-    return __getgrent(grp_fd);
+    }
+    r = __getgrent(grp_fd);
     UNLOCK;
     UNLOCK;
+    return r;
 }
 }