summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/grp.cc2
2 files changed, 6 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index a08fb7110..0955ce1a0 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2014-06-16 Denis Excoffier <cygwin@Denis-Excoffier.org>
+
+ * grp.cc (getgrouplist): Fix setting ngroups to make sure to return
+ the right value.
+
2014-06-05 Christopher Faylor <me.cygwin2014@cgf.cx>
* timer.cc (timer_tracker::cancel): Demote api_fatal to system_printf,
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc
index 43cae6dc4..f7ce61b08 100644
--- a/winsup/cygwin/grp.cc
+++ b/winsup/cygwin/grp.cc
@@ -656,11 +656,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;
else
ret = cnt;
+ *ngroups = cnt;
syscall_printf ( "%d = getgrouplist(%s, %u, %p, %d)",
ret, user, gid, groups, *ngroups);