mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
Fix `getgroups' for when zero supplementary group IDs exist.
* libguile/posix.c (scm_getgroups): Return the empty vector when NGROUPS is zero. Reported by Mike Gran <spk121@yahoo.com>.
This commit is contained in:
parent
91c763ee3f
commit
3d2b2676e3
1 changed files with 3 additions and 1 deletions
|
@ -265,8 +265,10 @@ SCM_DEFINE (scm_getgroups, "getgroups", 0, 0, 0,
|
|||
GETGROUPS_T *groups;
|
||||
|
||||
ngroups = getgroups (0, NULL);
|
||||
if (ngroups <= 0)
|
||||
if (ngroups < 0)
|
||||
SCM_SYSERROR;
|
||||
else if (ngroups == 0)
|
||||
return scm_c_make_vector (0, SCM_BOOL_F);
|
||||
|
||||
size = ngroups * sizeof (GETGROUPS_T);
|
||||
groups = scm_malloc (size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue