* grp.cc (getgrouplist): Fix setting ngroups to make sure to return

the right value.
This commit is contained in:
Corinna Vinschen 2014-06-16 09:12:29 +00:00
parent 84600df21d
commit 6681d11fd3
2 changed files with 6 additions and 1 deletions

View File

@ -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,

View File

@ -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);