Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/grp.cc')
-rw-r--r--winsup/cygwin/grp.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc
index 7ff9e59b2..b84966ad5 100644
--- a/winsup/cygwin/grp.cc
+++ b/winsup/cygwin/grp.cc
@@ -447,7 +447,7 @@ get_groups (const char *user, gid_t gid, cygsidlist &gsids)
cygsid usersid, grpsid;
if (usersid.getfrompw (pw))
get_server_groups (gsids, usersid, pw);
- if (grpsid.getfromgr (gr))
+ if (gid != ILLEGAL_GID && grpsid.getfromgr (gr))
gsids += grpsid;
cygheap->user.reimpersonate ();
}
@@ -501,9 +501,11 @@ getgrouplist (const char *user, gid_t gid, gid_t *groups, int *ngroups)
groups[cnt] = gr->gr_gid;
++cnt;
}
+ *ngroups = cnt;
if (cnt > *ngroups)
ret = -1;
- *ngroups = cnt;
+ else
+ ret = cnt;
syscall_printf ( "%d = getgrouplist(%s, %u, %p, %d)",
ret, user, gid, groups, *ngroups);