Date: Wed, 12 Oct 2011 01:19:12 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r226274 - head/usr.bin/newgrp Message-ID: <201110120119.p9C1JCPd040436@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Wed Oct 12 01:19:12 2011 New Revision: 226274 URL: http://svn.freebsd.org/changeset/base/226274 Log: - 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 Modified: head/usr.bin/newgrp/newgrp.c Modified: head/usr.bin/newgrp/newgrp.c ============================================================================== --- head/usr.bin/newgrp/newgrp.c Wed Oct 12 01:09:57 2011 (r226273) +++ head/usr.bin/newgrp/newgrp.c Wed Oct 12 01:19:12 2011 (r226274) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110120119.p9C1JCPd040436>