diff options
Diffstat (limited to 'src/passwd/getgrent.c')
-rw-r--r-- | src/passwd/getgrent.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/passwd/getgrent.c b/src/passwd/getgrent.c index e9d25eba..4cbe1ebf 100644 --- a/src/passwd/getgrent.c +++ b/src/passwd/getgrent.c @@ -23,17 +23,23 @@ struct group *getgrent() struct group *getgrgid(gid_t gid) { struct group *gr; + int errno_saved; setgrent(); while ((gr=getgrent()) && gr->gr_gid != gid); + errno_saved = errno; endgrent(); + errno = errno_saved; return gr; } struct group *getgrnam(const char *name) { struct group *gr; + int errno_saved; setgrent(); while ((gr=getgrent()) && strcmp(gr->gr_name, name)); + errno_saved = errno; endgrent(); + errno = errno_saved; return gr; } |