diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-10-31 20:17:01 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-10-31 20:17:01 +0000 |
commit | fff9c70e33036a80875dc25d359ef22c2c0a524c (patch) | |
tree | c563ad382704ce0734b270538089be9a36b80fa9 /libc/pwd_grp/__getgrent_r.c | |
parent | 86061e5f2b7f2cde3edd25615de2e2bbd95b1ff9 (diff) |
getpwent(), getpwent_r(), and getgrent(), getgrent_r() would all
fail if you had not previously called setpwent() or setgrent()
respectively. Oops. My bad.
-Erik
Diffstat (limited to 'libc/pwd_grp/__getgrent_r.c')
-rw-r--r-- | libc/pwd_grp/__getgrent_r.c | 3 |
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 */ |