diff options
author | wpaul <wpaul@FreeBSD.org> | 1995-09-02 04:08:55 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1995-09-02 04:08:55 +0000 |
commit | 6e8a774b0bbbf0bee95cbe6a5e67124fd0a51292 (patch) | |
tree | b4291fa214fdeb3695317da2efb57f708bde3493 /lib/libc/gen/getgrent.c | |
parent | 7ec855ea34c4df9137a3a8bb27d4cc4fa428610b (diff) | |
download | FreeBSD-src-6e8a774b0bbbf0bee95cbe6a5e67124fd0a51292.zip FreeBSD-src-6e8a774b0bbbf0bee95cbe6a5e67124fd0a51292.tar.gz |
getpwent.c: turn the code that checks the override caches into a
seperate function to avoid duplication. Also fix getpwent() a
small bit to properly handle the case where the magic NIS '+'
entry appears before the end of the password file.
getgrent.c: be a little more SunOS-ish. Make it look like the NIS
group map is 'inserted' at the the point(s) where the magic NIS '+'
entry/entries appear.
getgrent: fix a file descriptor leak: remember to close the netgroup
file after we determine that we're using NIS-only innetgr() lookups.
Diffstat (limited to 'lib/libc/gen/getgrent.c')
-rw-r--r-- | lib/libc/gen/getgrent.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c index 3a4a067b..0d393be 100644 --- a/lib/libc/gen/getgrent.c +++ b/lib/libc/gen/getgrent.c @@ -69,8 +69,10 @@ getgrent() #ifdef YP if (_gr_stepping_yp) { - return (_nextypgroup(&_gr_group) ? &_gr_group : 0); + if (_nextypgroup(&_gr_group)) + return(&_gr_group); } +tryagain: #endif if (!grscan(0, 0, NULL)) @@ -80,7 +82,10 @@ getgrent() _getypgroup(&_gr_group, &_gr_group.gr_name[1], "group.byname"); } else if(_gr_group.gr_name[0] == '+') { - return (_nextypgroup(&_gr_group) ? &_gr_group : 0); + if (!_nextypgroup(&_gr_group)) + goto tryagain; + else + return(&_gr_group); } #endif return(&_gr_group); |