Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > 277509a89486abacadb546916a2aa6b7 > files > 9

coreutils-6.12-2mdv2009.0.src.rpm

--- coreutils-6.11/lib/getugroups.c~	2008-04-06 23:42:54.000000000 +0800
+++ coreutils-6.11/lib/getugroups.c	2008-05-02 02:43:52.000000000 +0800
@@ -66,8 +66,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)
 	{
@@ -93,6 +97,7 @@
 	      if (count == INT_MAX)
 		{
 		  errno = EOVERFLOW;
+		  count = -1;
 		  goto done;
 		}
 	      count++;