aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-02-20 15:46:48 +0000
committerCorinna Vinschen <corinna@vinschen.de>2014-02-20 15:46:48 +0000
commit1e3a150969d4427c117f0510bee159dbdfe374b6 (patch)
tree3aeb6a94df46b08f76f20376ffd9affb4d3d87b0
parent2dc219640db11c4421d3550f9423dba069a0f2c6 (diff)
downloadnewlib-1e3a150969d4427c117f0510bee159dbdfe374b6.zip
newlib-1e3a150969d4427c117f0510bee159dbdfe374b6.tar.gz
newlib-1e3a150969d4427c117f0510bee159dbdfe374b6.tar.bz2
* grp.cc (getgrouplist): Fix previous fix so ret is only set to ngroups
if ngroups isn't too small.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/grp.cc4
2 files changed, 8 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 506a63b..e54075b 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2014-02-20 Corinna Vinschen <corinna@vinschen.de>
+ * grp.cc (getgrouplist): Fix previous fix so ret is only set to ngroups
+ if ngroups isn't too small.
+
+2014-02-20 Corinna Vinschen <corinna@vinschen.de>
+
* grp.cc (get_groups): Don't add gid to list if it's ILLEGAL_GID.
(getgrouplist): Return number of groups, just like glibc.
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc
index 665cb17..c82efc9 100644
--- a/winsup/cygwin/grp.cc
+++ b/winsup/cygwin/grp.cc
@@ -624,9 +624,11 @@ getgrouplist (const char *user, gid_t gid, gid_t *groups, int *ngroups)
groups[cnt] = grp->gr_gid;
++cnt;
}
+ *ngroups = cnt;
if (cnt > *ngroups)
ret = -1;
- ret = *ngroups = cnt;
+ else
+ ret = cnt;
syscall_printf ( "%d = getgrouplist(%s, %u, %p, %d)",
ret, user, gid, groups, *ngroups);