* grp.cc (get_groups): Never return error. Always create a group list,

even if it's empty.
This commit is contained in:
Corinna Vinschen 2013-05-14 08:50:37 +00:00
parent d46cc674ec
commit ee6ed1db45
2 changed files with 10 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2013-05-14 Corinna Vinschen <corinna@vinschen.de>
* grp.cc (get_groups): Never return error. Always create a group list,
even if it's empty.
2013-05-13 Christopher Faylor <me.cygwin2013@cgf.cx>
* include/cygwin/version.h: Bump api minor number to reflect previous

View File

@ -441,21 +441,16 @@ getgroups (int gidsetsize, __gid16_t *grouplist)
static int
get_groups (const char *user, gid_t gid, cygsidlist &gsids)
{
int ret = -1;
cygheap->user.deimpersonate ();
struct passwd *pw = internal_getpwnam (user);
struct group *gr = internal_getgrgid (gid);
cygsid usersid, grpsid;
if (!usersid.getfrompw (pw) || !grpsid.getfromgr (gr))
set_errno (EINVAL);
else if (get_server_groups (gsids, usersid, pw))
{
gsids += grpsid;
ret = 0;
}
if (usersid.getfrompw (pw))
get_server_groups (gsids, usersid, pw);
if (grpsid.getfromgr (gr))
gsids += grpsid;
cygheap->user.reimpersonate ();
return ret;
return 0;
}
extern "C" int