diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-02-20 19:46:48 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-02-20 19:46:48 +0400 |
commit | 1e3a150969d4427c117f0510bee159dbdfe374b6 (patch) | |
tree | 3aeb6a94df46b08f76f20376ffd9affb4d3d87b0 /winsup/cygwin/grp.cc | |
parent | 2dc219640db11c4421d3550f9423dba069a0f2c6 (diff) |
* grp.cc (getgrouplist): Fix previous fix so ret is only set to ngroups
if ngroups isn't too small.
Diffstat (limited to 'winsup/cygwin/grp.cc')
-rw-r--r-- | winsup/cygwin/grp.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index 665cb173d..c82efc90b 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); |