summaryrefslogtreecommitdiff
path: root/lib/libc/gen/initgroups.c
diff options
context:
space:
mode:
authorlukem <lukem@NetBSD.org>1999-03-31 12:19:32 +0000
committerlukem <lukem@NetBSD.org>1999-03-31 12:19:32 +0000
commit3ebdcecd65bbddb1cf73da2c4ce5ffc8cc7bb1d8 (patch)
tree27f7d7f9ff73a4f08cc3f66d182c1f651ba7e3c0 /lib/libc/gen/initgroups.c
parent5af7e7a902045131997ba12ed2cd98f88236a11f (diff)
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> in [lib/7273]
Diffstat (limited to 'lib/libc/gen/initgroups.c')
-rw-r--r--lib/libc/gen/initgroups.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/libc/gen/initgroups.c b/lib/libc/gen/initgroups.c
index 5c446ba8f6a..82bf3d2b903 100644
--- a/lib/libc/gen/initgroups.c
+++ b/lib/libc/gen/initgroups.c
@@ -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 @@ __RCSID("$NetBSD: initgroups.c,v 1.15 1998/02/27 18:09:39 perry Exp $");
#include <stdio.h>
#include <unistd.h>
-#include <err.h>
#ifdef __weak_alias
__weak_alias(initgroups,_initgroups);
@@ -62,12 +61,8 @@ initgroups(uname, agroup)
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);
}