summaryrefslogtreecommitdiff
path: root/libc/pwd_grp/grent.c
diff options
context:
space:
mode:
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;
}