diff options
author | ache <ache@FreeBSD.org> | 1999-10-16 12:31:49 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1999-10-16 12:31:49 +0000 |
commit | 1da654c6bb716ddef489e0bcbbc157dedf0700c2 (patch) | |
tree | 6cdbc5a2c4a4091f9db948b3099a65bdd5a31f2b /lib/libc/gen/getpwent.c | |
parent | 60d57ae1fe8e9900da1bfa70d6c59522d49cdc1e (diff) | |
download | FreeBSD-src-1da654c6bb716ddef489e0bcbbc157dedf0700c2.zip FreeBSD-src-1da654c6bb716ddef489e0bcbbc157dedf0700c2.tar.gz |
YP/NIS code: remove unnecessary endgrent() calls which can cause fail on
next try over chroot (descriptor closed). getgrnam() used already handles
endgrent() properly and honors _gr_stayopen. Automatically call
setgroupent(1) when _pw_stayopen is set (for YP/NIS code).
Diffstat (limited to 'lib/libc/gen/getpwent.c')
-rw-r--r-- | lib/libc/gen/getpwent.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index 9f95344..90dbb4a 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -231,6 +231,8 @@ setpassent(stayopen) _pw_keynum = 0; #ifdef YP _pw_stepping_yp = 0; + if (stayopen) + setgroupent(1); #endif _pw_stayopen = stayopen; return(1); @@ -429,7 +431,6 @@ grpagain: gr->gr_mem++; return(rv); } else { - endgrent(); latch = 0; _pw_stepping_yp = 0; gr = NULL; @@ -496,14 +497,11 @@ ingr(grp, name) return(0); while(*gr->gr_mem) { - if (!strcmp(*gr->gr_mem, name)) { - endgrent(); + if (!strcmp(*gr->gr_mem, name)) return(1); - } gr->gr_mem++; } - endgrent(); return(0); } |