diff --git a/lib/libc/gen/initgroups.c b/lib/libc/gen/initgroups.c --- a/lib/libc/gen/initgroups.c +++ b/lib/libc/gen/initgroups.c @@ -31,11 +31,7 @@ #include -#include "namespace.h" -#include -#include "un-namespace.h" #include -#include #include #include @@ -51,12 +47,13 @@ * setgroups to fail and set errno. */ ngroups_max = sysconf(_SC_NGROUPS_MAX) + 2; - if ((groups = malloc(sizeof(*groups) * ngroups_max)) == NULL) - return (ENOMEM); + groups = malloc(sizeof(*groups) * ngroups_max); + if (groups == NULL) + return (-1); /* malloc() set 'errno'. */ ngroups = (int)ngroups_max; getgrouplist(uname, agroup, groups, &ngroups); ret = setgroups(ngroups, groups); free(groups); - return (ret); + return (ret); /* setgroups() set 'errno'. */ }