- Fix an off-by-one bug in addgroup().
- Fix the error message when setgid() failed. PR: bin/161509 Submitted by: Jeremy Huddleston <jeremyhu apple com> MFC after: 2 weeks
This commit is contained in:
parent
16b6dcb054
commit
c0ed9a753b
@ -140,7 +140,7 @@ restoregrps(void)
|
||||
if (initres < 0)
|
||||
warn("initgroups");
|
||||
if (setres < 0)
|
||||
warn("setgroups");
|
||||
warn("setgid");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -220,7 +220,7 @@ addgroup(const char *grpname)
|
||||
|
||||
/* Add old effective gid to supp. list if it does not exist. */
|
||||
if (egid != grp->gr_gid && !inarray(egid, grps, ngrps)) {
|
||||
if (ngrps == ngrps_max)
|
||||
if (ngrps + 1 >= ngrps_max)
|
||||
warnx("too many groups");
|
||||
else {
|
||||
grps[ngrps++] = egid;
|
||||
|
Loading…
Reference in New Issue
Block a user