aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/grp.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-02-20 13:55:57 +0000
committerCorinna Vinschen <corinna@vinschen.de>2014-02-20 13:55:57 +0000
commit7f57a4ea14acc4bd041b38390fbc9cc5765c5772 (patch)
treeeee8d07cb107c9cd0dd1bc02b1097409d72e051a /winsup/cygwin/grp.cc
parent23c0f215943788c10b623a8a742146917fb32250 (diff)
downloadnewlib-7f57a4ea14acc4bd041b38390fbc9cc5765c5772.zip
newlib-7f57a4ea14acc4bd041b38390fbc9cc5765c5772.tar.gz
newlib-7f57a4ea14acc4bd041b38390fbc9cc5765c5772.tar.bz2
* grp.cc (get_groups): Don't add gid to list if it's ILLEGAL_GID.
(getgrouplist): Return number of groups, just like glibc.
Diffstat (limited to 'winsup/cygwin/grp.cc')
-rw-r--r--winsup/cygwin/grp.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc
index 18e0916..665cb17 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);