diff options
author | ache <ache@FreeBSD.org> | 1999-10-16 11:50:37 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1999-10-16 11:50:37 +0000 |
commit | a512dc84f75391d4b0dda33c9dd48801864ad8b0 (patch) | |
tree | 905a6fe515d1830aa379244efc6cf1844e17d5e6 /lib/libc | |
parent | 16dcdca31e8b84ec8465f99be52857e8a613b94b (diff) | |
download | FreeBSD-src-a512dc84f75391d4b0dda33c9dd48801864ad8b0.zip FreeBSD-src-a512dc84f75391d4b0dda33c9dd48801864ad8b0.tar.gz |
Fix longstanding bug "unused stayopen" introduced in rev1.11
PR: 14201
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/getpwent.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index c2833de..9f95344 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -29,6 +29,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ #if defined(LIBC_SCCS) && !defined(lint) @@ -176,7 +178,8 @@ getpwnam(name) if (rval && (_pw_passwd.pw_name[0] == '+'|| _pw_passwd.pw_name[0] == '-')) rval = 0; - endpwent(); + if (!_pw_stayopen) + endpwent(); return(rval ? &_pw_passwd : (struct passwd *)NULL); } @@ -216,7 +219,8 @@ getpwuid(uid) if (rval && (_pw_passwd.pw_name[0] == '+'|| _pw_passwd.pw_name[0] == '-')) rval = 0; - endpwent(); + if (!_pw_stayopen) + endpwent(); return(rval ? &_pw_passwd : (struct passwd *)NULL); } |