This will allow using lsearch(3).
Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
continue;
}
+ grouplist = REALLOCF(grouplist, ngroups + 1, GETGROUPS_T);
+ if (grouplist == NULL)
+ return -1;
+
if (LFIND(&grp->gr_gid, grouplist, ngroups) != NULL)
continue;
fputs (_("Warning: too many groups\n"), shadow_logfd);
break;
}
- grouplist = REALLOCF(grouplist, ngroups + 1, GETGROUPS_T);
- if (grouplist == NULL) {
- return -1;
- }
+
grouplist[ngroups] = grp->gr_gid;
ngroups++;
added = true;