aboutsummaryrefslogtreecommitdiffstats
path: root/guts/getpwnam_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'guts/getpwnam_r.c')
-rw-r--r--guts/getpwnam_r.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/guts/getpwnam_r.c b/guts/getpwnam_r.c
index 1a870f2..5d7a4ea 100644
--- a/guts/getpwnam_r.c
+++ b/guts/getpwnam_r.c
@@ -10,8 +10,10 @@
setpwent();
while ((rc = wrap_getpwent_r(pwbuf, buf, buflen, pwbufp)) == 0) {
/* 0 means no error occurred, and *pwbufp == pwbuf */
- if (pwbuf->pw_name && !strcmp(pwbuf->pw_name, name))
+ if (pwbuf->pw_name && !strcmp(pwbuf->pw_name, name)) {
+ endpwent();
return rc;
+ }
}
endpwent();
/* we never found a match; rc is 0 if there was no error, or