Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/gen don't use warn() in initgroups(); it's not docu...



details:   https://anonhg.NetBSD.org/src/rev/96f57123de2b
branches:  trunk
changeset: 467939:96f57123de2b
user:      lukem <lukem%NetBSD.org@localhost>
date:      Wed Mar 31 12:19:32 1999 +0000

description:
don't use warn() in initgroups(); it's not documented to do that, and
if stderr isn't valid the caller may dump core.
from Giles Lean <giles%nemeton.com.au@localhost> in [lib/7273]

diffstat:

 lib/libc/gen/initgroups.c |  13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diffs (41 lines):

diff -r ca7428e44410 -r 96f57123de2b lib/libc/gen/initgroups.c
--- a/lib/libc/gen/initgroups.c Wed Mar 31 11:53:07 1999 +0000
+++ b/lib/libc/gen/initgroups.c Wed Mar 31 12:19:32 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: initgroups.c,v 1.15 1998/02/27 18:09:39 perry Exp $    */
+/*     $NetBSD: initgroups.c,v 1.16 1999/03/31 12:19:32 lukem Exp $    */
 
 /*
  * Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)initgroups.c       8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: initgroups.c,v 1.15 1998/02/27 18:09:39 perry Exp $");
+__RCSID("$NetBSD: initgroups.c,v 1.16 1999/03/31 12:19:32 lukem Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -47,7 +47,6 @@
 
 #include <stdio.h>
 #include <unistd.h>
-#include <err.h>
 
 #ifdef __weak_alias
 __weak_alias(initgroups,_initgroups);
@@ -62,12 +61,8 @@
        int 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");
+       getgrouplist(uname, agroup, groups, &ngroups);
+       if (setgroups(ngroups, groups) < 0)
                return (-1);
-       }
        return (0);
 }



Home | Main Index | Thread Index | Old Index