Sophie

Sophie

distrib > Mageia > cauldron > x86_64 > media > core-release-src > by-pkgid > 19862556dd30693507541a3c26b445c4 > files > 7

coreutils-9.4-2.mga10.src.rpm

--- coreutils-8.3/lib/getugroups.c.groups	2010-01-04 17:19:05.000000000 +0100
+++ coreutils-8.3/lib/getugroups.c	2010-01-11 07:09:44.000000000 +0100
@@ -75,8 +75,12 @@
 
       errno = 0;
       grp = getgrent ();
-      if (grp == NULL)
+      if (grp == NULL) {
+	if (errno == ENOENT)
+		/* expected at the end of the group list, so ignore errno */
+		errno =0;
         break;
+      }
 
       for (cp = grp->gr_mem; *cp; ++cp)
         {
@@ -102,6 +106,7 @@
               if (count == INT_MAX)
                 {
                   errno = EOVERFLOW;
+		  count = -1;
                   goto done;
                 }
               count++;