* 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> 2013-05-13 Christopher Faylor <me.cygwin2013@cgf.cx>
* include/cygwin/version.h: Bump api minor number to reflect previous * 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 static int
get_groups (const char *user, gid_t gid, cygsidlist &gsids) get_groups (const char *user, gid_t gid, cygsidlist &gsids)
{ {
int ret = -1;
cygheap->user.deimpersonate (); cygheap->user.deimpersonate ();
struct passwd *pw = internal_getpwnam (user); struct passwd *pw = internal_getpwnam (user);
struct group *gr = internal_getgrgid (gid); struct group *gr = internal_getgrgid (gid);
cygsid usersid, grpsid; cygsid usersid, grpsid;
if (!usersid.getfrompw (pw) || !grpsid.getfromgr (gr)) if (usersid.getfrompw (pw))
set_errno (EINVAL); get_server_groups (gsids, usersid, pw);
else if (get_server_groups (gsids, usersid, pw)) if (grpsid.getfromgr (gr))
{ gsids += grpsid;
gsids += grpsid;
ret = 0;
}
cygheap->user.reimpersonate (); cygheap->user.reimpersonate ();
return ret; return 0;
} }
extern "C" int extern "C" int