1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

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).
This commit is contained in:
Andrey A. Chernov 1999-10-16 12:31:49 +00:00
parent ea00c9343b
commit 0200080b60
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=52310

View File

@ -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 @@ unwind(grp)
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);
}