diff options
author | tobez <tobez@FreeBSD.org> | 2001-11-28 10:55:02 +0000 |
---|---|---|
committer | tobez <tobez@FreeBSD.org> | 2001-11-28 10:55:02 +0000 |
commit | 390c9f0f6ee0486a427e4caeea12828da443b805 (patch) | |
tree | c98e3ceceeb1cee49d8a3d0e9586c3f263f2f0dd | |
parent | 6828ec15153c53bfa2f4ad08ab0dcee1d1c70b63 (diff) | |
download | FreeBSD-src-390c9f0f6ee0486a427e4caeea12828da443b805.zip FreeBSD-src-390c9f0f6ee0486a427e4caeea12828da443b805.tar.gz |
Do not write warning messages on stderr - a caller is expected to check
the return code and errno instead. Those warnings did not do any good
for daemonized users of initgroups(3), and confused cvs clients that
communicated with non-root cvs pserver.
The committed fix differs from the one suggested in the PR, and was
submitted by ru.
PR: 15421
Approved by: markm
Discussed on: -stable, -current at various times
-rw-r--r-- | lib/libc/gen/initgroups.3 | 8 | ||||
-rw-r--r-- | lib/libc/gen/initgroups.c | 10 |
2 files changed, 8 insertions, 10 deletions
diff --git a/lib/libc/gen/initgroups.3 b/lib/libc/gen/initgroups.3 index eb11151..115ab0c 100644 --- a/lib/libc/gen/initgroups.3 +++ b/lib/libc/gen/initgroups.3 @@ -61,10 +61,14 @@ is automatically included in the groups list. Typically this value is given as the group number from the password file. .Sh RETURN VALUES +.Rv -std initgroups +.Sh ERRORS The .Fn initgroups -function -returns \-1 if it was not invoked by the super-user. +function may fail and set +.Va errno +for any of the errors specified for the library function +.Xr setgroups 2 . .Sh SEE ALSO .Xr setgroups 2 , .Xr getgrouplist 3 diff --git a/lib/libc/gen/initgroups.c b/lib/libc/gen/initgroups.c index 9918955..3fc9bb2 100644 --- a/lib/libc/gen/initgroups.c +++ b/lib/libc/gen/initgroups.c @@ -56,12 +56,6 @@ initgroups(uname, agroup) int groups[NGROUPS], ngroups; ngroups = NGROUPS; - if (getgrouplist(uname, agroup, groups, &ngroups) < 0) - warnx("%s is in too many groups, using first %d", - uname, ngroups); - if (setgroups(ngroups, groups) < 0) { - _warn("setgroups"); - return (-1); - } - return (0); + getgrouplist(uname, agroup, groups, &ngroups); + return (setgroups(ngroups, groups)); } |