summaryrefslogtreecommitdiff
path: root/libc/pwd_grp/__getgrent_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/pwd_grp/__getgrent_r.c')
-rw-r--r--libc/pwd_grp/__getgrent_r.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libc/pwd_grp/__getgrent_r.c b/libc/pwd_grp/__getgrent_r.c
index 69559bdb1..d5b2e99f1 100644
--- a/libc/pwd_grp/__getgrent_r.c
+++ b/libc/pwd_grp/__getgrent_r.c
@@ -44,6 +44,9 @@ int __getgrent_r (struct group *__restrict group,
return ERANGE;
}
+ if (grp_fd==-1)
+ setgrent();
+
/* We use the restart label to handle malformatted lines */
restart:
/* Read the group line into the buffer for processing */