about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-04-19 17:16:11 -0400
committerUlrich Drepper <drepper@gmail.com>2011-04-19 17:16:11 -0400
commit00401ad5b08e86f2a912a640487c34006c7c27e3 (patch)
tree7a422478102fb9a19359e00624811f9bdc15cd93
parentab8eed78a6614f7e7e5a908efdcb9f390f849563 (diff)
downloadglibc-00401ad5b08e86f2a912a640487c34006c7c27e3.tar.gz
glibc-00401ad5b08e86f2a912a640487c34006c7c27e3.tar.xz
glibc-00401ad5b08e86f2a912a640487c34006c7c27e3.zip
Fix little issue with last change.
-rw-r--r--nss/nss_files/files-initgroups.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/nss/nss_files/files-initgroups.c b/nss/nss_files/files-initgroups.c
index 2d84cd8457..1c288e5ae3 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)
 	    {