35 gid_t groups[NGROUPS_MAX];
41 groups[index++] = basegid;
43 while (index < NGROUPS_MAX && ((g = getgrent()) !=
NULL)) {
44 if (g->gr_gid != basegid) {
47 for (names = g->gr_mem; *names !=
NULL; ++names) {
49 if (!strcmp(*names, name))
50 groups[index++] = g->gr_gid;
58 return setgroups(index, groups);
int initgroups(const char *name, gid_t basegid)