* lib/getugroups.c (getugroups): Don't return without calling endgrent.
+2007-07-05 Jim Meyering <jim@meyering.net>
+
+ Close the group DB even when failing with 2^31 or more members.
+ * lib/getugroups.c (getugroups): Don't return without calling endgrent.
+
2007-07-04 Jim Meyering <jim@meyering.net>
* lib/getugroups.h: New file.
if (maxcount != 0)
{
if (count >= maxcount)
- {
- endgrent ();
- return count;
- }
+ goto done;
grouplist[count] = grp->gr_gid;
}
count++;
if (count < 0)
{
errno = EOVERFLOW;
- return -1;
+ count = -1;
+ goto done;
}
}
}
}
+
+ done:
endgrent ();
return count;