/* mgetgroups.c -- return a list of the groups a user or current process is in
- Copyright (C) 2007-2011 Free Software Foundation, Inc.
+ Copyright (C) 2007-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
return -1;
}
- if (!username && gid != (gid_t) -1)
+ if (max_n_groups == 0 || (!username && gid != (gid_t) -1))
max_n_groups++;
g = realloc_groupbuf (NULL, max_n_groups);
if (g == NULL)