summaryrefslogtreecommitdiff
path: root/usr.bin/vmstat
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-07-08 22:14:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-07-08 22:14:38 +0000
commitc42d3dfc6a3f99fbbe1a0c87af2f3705ea3ce262 (patch)
treeb2801e83b20e253f4a46ba0d4341d06e3695199c /usr.bin/vmstat
parent5d7745af6274ad1c61f601a05048c86ed26cf8a9 (diff)
whack kmem gid after kvm_openfiles()
Diffstat (limited to 'usr.bin/vmstat')
-rw-r--r--usr.bin/vmstat/vmstat.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c
index 1517c94996f..3a67b89047d 100644
--- a/usr.bin/vmstat/vmstat.c
+++ b/usr.bin/vmstat/vmstat.c
@@ -1,5 +1,5 @@
/* $NetBSD: vmstat.c,v 1.29.4.1 1996/06/05 00:21:05 cgd Exp $ */
-/* $OpenBSD: vmstat.c,v 1.24 1998/05/19 17:38:20 mickey Exp $ */
+/* $OpenBSD: vmstat.c,v 1.25 1998/07/08 22:14:18 deraadt Exp $ */
/*
* Copyright (c) 1980, 1986, 1991, 1993
@@ -185,7 +185,7 @@ main(argc, argv)
register int c, todo;
u_int interval;
int reps;
- char errbuf[_POSIX2_LINE_MAX];
+ char errbuf[_POSIX2_LINE_MAX];
memf = nlistf = NULL;
interval = reps = todo = 0;
@@ -238,7 +238,7 @@ main(argc, argv)
setgid(getgid());
}
- kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf);
+ kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf);
if (kd == 0) {
(void)fprintf(stderr,
"vmstat: kvm_openfiles: %s\n", errbuf);
@@ -246,6 +246,10 @@ main(argc, argv)
}
if ((c = kvm_nlist(kd, namelist)) != 0) {
+
+ setegid(getgid());
+ setgid(getgid());
+
if (c > 0) {
(void)fprintf(stderr,
"vmstat: undefined symbols:");
@@ -273,6 +277,9 @@ main(argc, argv)
}
+ setegid(getgid());
+ setgid(getgid());
+
#define BACKWARD_COMPATIBILITY
#ifdef BACKWARD_COMPATIBILITY
if (*argv) {