summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/grp.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/grp.cc')
-rw-r--r--winsup/cygwin/grp.cc15
1 files changed, 5 insertions, 10 deletions
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