diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 71717883e..506a63bcd 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2014-02-20 Corinna Vinschen + + * grp.cc (get_groups): Don't add gid to list if it's ILLEGAL_GID. + (getgrouplist): Return number of groups, just like glibc. + 2014-02-19 Corinna Vinschen * passwd.cc (pg_ent::setent): Initialize cygheap domain info. diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index 18e091642..665cb173d 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -570,7 +570,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 (grp)) + if (gid != ILLEGAL_GID && grpsid.getfromgr (grp)) gsids += grpsid; cygheap->user.reimpersonate (); } @@ -626,7 +626,7 @@ getgrouplist (const char *user, gid_t gid, gid_t *groups, int *ngroups) } if (cnt > *ngroups) ret = -1; - *ngroups = cnt; + ret = *ngroups = cnt; syscall_printf ( "%d = getgrouplist(%s, %u, %p, %d)", ret, user, gid, groups, *ngroups);