* NEWS, libmisc/addgrps.c: Fix allocator loop. Continue to

getgroups() when getgroups fails (-1) with errno==EINVAL.
This commit is contained in:
nekral-guest
2011-06-02 15:36:29 +00:00
parent 99d0164837
commit f140c3a0e5
3 changed files with 14 additions and 1 deletions

View File

@@ -71,7 +71,11 @@ int add_groups (const char *list)
return -1;
}
ngroups = getgroups (i, grouplist);
if ((-1 == ngroups) || (i > (size_t)ngroups)) {
if ( ( (-1 == ngroups)
&& (EINVAL != errno))
|| (i > (size_t)ngroups)) {
/* Unexpected failure of getgroups or successful
* reception of the groups */
break;
}
/* not enough room, so try allocating a larger buffer */