summaryrefslogtreecommitdiffstats
path: root/usr.bin/vmstat/vmstat.c
diff options
context:
space:
mode:
authorlum <lum@openbsd.org>2010-07-20 19:43:19 +0000
committerlum <lum@openbsd.org>2010-07-20 19:43:19 +0000
commit5d88d53711bb0fbac3ea7cc894af7521db3cb0db (patch)
tree5ad43a6917f982a3c05a19a85c406d8cf2d853f7 /usr.bin/vmstat/vmstat.c
parentdisconnect groff_man(7) from the build and install man(7) instead; (diff)
downloadwireguard-openbsd-5d88d53711bb0fbac3ea7cc894af7521db3cb0db.tar.xz
wireguard-openbsd-5d88d53711bb0fbac3ea7cc894af7521db3cb0db.zip
Remove setresguid since it is no longer needed.
ok matthew@ millert@ deraadt@
Diffstat (limited to 'usr.bin/vmstat/vmstat.c')
-rw-r--r--usr.bin/vmstat/vmstat.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c
index 288e70795e8..c6d968e2362 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.114 2009/11/22 22:22:14 tedu Exp $ */
+/* $OpenBSD: vmstat.c,v 1.115 2010/07/20 19:43:19 lum Exp $ */
/*
* Copyright (c) 1980, 1986, 1991, 1993
@@ -138,7 +138,6 @@ main(int argc, char *argv[])
const char *errstr;
u_int interval = 0;
size_t size;
- gid_t gid;
while ((c = getopt(argc, argv, "c:fiM:mN:stw:vz")) != -1) {
switch (c) {
@@ -188,25 +187,12 @@ main(int argc, char *argv[])
if (todo == 0)
todo = VMSTAT;
- gid = getgid();
if (nlistf != NULL || memf != NULL) {
- if (setresgid(gid, gid, gid) == -1)
- err(1, "setresgid");
- }
- /*
- * 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) {
kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf);
if (kd == 0)
errx(1, "kvm_openfiles: %s", errbuf);
- if (nlistf == NULL && memf == NULL)
- if (setresgid(gid, gid, gid) == -1)
- err(1, "setresgid");
-
if ((c = kvm_nlist(kd, namelist)) != 0) {
if (c > 0) {
@@ -223,8 +209,7 @@ main(int argc, char *argv[])
} else
errx(1, "kvm_nlist: %s", kvm_geterr(kd));
}
- } else if (setresgid(gid, gid, gid) == -1)
- err(1, "setresgid");
+ }
mib[0] = CTL_HW;
mib[1] = HW_NCPU;