summaryrefslogtreecommitdiff
path: root/usr.bin/nfsstat/nfsstat.c
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-12-22 03:26:11 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-12-22 03:26:11 +0000
commitb9e51bce4b9f1693731b39bfbb2873af2e60d83c (patch)
tree9844363957c023a88374765f72c1a49440395ac5 /usr.bin/nfsstat/nfsstat.c
parenta34740287ce7a6f408b47749029e29e62a63724d (diff)
Deal with _POSIX_SAVED_IDS when relinquishing privileges
Diffstat (limited to 'usr.bin/nfsstat/nfsstat.c')
-rw-r--r--usr.bin/nfsstat/nfsstat.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/nfsstat/nfsstat.c b/usr.bin/nfsstat/nfsstat.c
index 6e35c4a5a33..d84b73da9bc 100644
--- a/usr.bin/nfsstat/nfsstat.c
+++ b/usr.bin/nfsstat/nfsstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsstat.c,v 1.4 1996/12/15 18:52:19 kstailey Exp $ */
+/* $OpenBSD: nfsstat.c,v 1.5 1996/12/22 03:25:59 tholo Exp $ */
/* $NetBSD: nfsstat.c,v 1.7 1996/03/03 17:21:30 thorpej Exp $ */
/*
@@ -48,7 +48,7 @@ static char copyright[] =
static char sccsid[] = "from: @(#)nfsstat.c 8.1 (Berkeley) 6/6/93";
static char *rcsid = "$NetBSD: nfsstat.c,v 1.7 1996/03/03 17:21:30 thorpej Exp $";
#else
-static char *rcsid = "$OpenBSD: nfsstat.c,v 1.4 1996/12/15 18:52:19 kstailey Exp $";
+static char *rcsid = "$OpenBSD: nfsstat.c,v 1.5 1996/12/22 03:25:59 tholo Exp $";
#endif
#endif /* not lint */
@@ -138,8 +138,10 @@ main(argc, argv)
* Discard setgid privileges if not the running kernel so that bad
* guys can't print interesting stuff from kernel memory.
*/
- if (nlistf != NULL || memf != NULL)
+ if (nlistf != NULL || memf != NULL) {
+ setegid(getgid());
setgid(getgid());
+ }
if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf)) == 0) {
fprintf(stderr, "nfsstat: kvm_openfiles: %s\n", errbuf);