From 00401ad5b08e86f2a912a640487c34006c7c27e3 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 19 Apr 2011 17:16:11 -0400 Subject: [PATCH] Fix little issue with last change. --- nss/nss_files/files-initgroups.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nss/nss_files/files-initgroups.c b/nss/nss_files/files-initgroups.c index 2d84cd8..1c288e5 100644 --- a/nss/nss_files/files-initgroups.c +++ b/nss/nss_files/files-initgroups.c @@ -63,7 +63,9 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start, } struct group grp; - while (_nss_files_parse_grent (line, &grp, buffer, buflen, errnop) == -1) + int res; + while ((res = _nss_files_parse_grent (line, &grp, buffer, buflen, + errnop)) == -1) { size_t newbuflen = 2 * buflen; if (buffer_use_malloc || ! __libc_use_alloca (buflen + newbuflen)) @@ -83,7 +85,7 @@ _nss_files_initgroups_dyn (const char *user, gid_t group, long int *start, buffer = extend_alloca (buffer, buflen, newbuflen); } - if (grp.gr_gid != group) + if (res > 0 && grp.gr_gid != group) for (char **m = grp.gr_mem; *m != NULL; ++m) if (strcmp (*m, user) == 0) { -- 2.7.4