From ee6ed1db45b2da59b18f705909933bbfe1854917 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 14 May 2013 08:50:37 +0000 Subject: [PATCH] * grp.cc (get_groups): Never return error. Always create a group list, even if it's empty. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/grp.cc | 15 +++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 6d72b0d03..4c2693f71 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2013-05-14 Corinna Vinschen + + * grp.cc (get_groups): Never return error. Always create a group list, + even if it's empty. + 2013-05-13 Christopher Faylor * include/cygwin/version.h: Bump api minor number to reflect previous diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index a2ab5b635..59ec5becc 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -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