diff options
Diffstat (limited to 'guts/getgrnam_r.c')
-rw-r--r-- | guts/getgrnam_r.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/guts/getgrnam_r.c b/guts/getgrnam_r.c index 73c1c45..39de641 100644 --- a/guts/getgrnam_r.c +++ b/guts/getgrnam_r.c @@ -10,8 +10,10 @@ setgrent(); while ((rc = wrap_getgrent_r(gbuf, buf, buflen, gbufp)) == 0) { /* 0 means no error occurred, and *gbufp == gbuf */ - if (gbuf->gr_name && !strcmp(gbuf->gr_name, name)) + if (gbuf->gr_name && !strcmp(gbuf->gr_name, name)) { + endgrent(); return rc; + } } endgrent(); /* we never found a match; rc is 0 if there was no error, or |