diff options
author | lum <lum@cvs.openbsd.org> | 2010-07-20 19:43:20 +0000 |
---|---|---|
committer | lum <lum@cvs.openbsd.org> | 2010-07-20 19:43:20 +0000 |
commit | d4f0bbdaf37f5cbc273bf4476a553eb7dc72bf60 (patch) | |
tree | c4920c2f6ebde0ea551a7a2b176d8bddffbd8aee | |
parent | bf45c1d439ace74b1f3b98254ed48b454bdcac3d (diff) |
Remove setresguid since it is no longer needed.
ok matthew@ millert@ deraadt@
-rw-r--r-- | usr.bin/vmstat/dkstats.c | 12 | ||||
-rw-r--r-- | usr.bin/vmstat/vmstat.c | 19 |
2 files changed, 3 insertions, 28 deletions
diff --git a/usr.bin/vmstat/dkstats.c b/usr.bin/vmstat/dkstats.c index a16c9385772..f7877d52c4b 100644 --- a/usr.bin/vmstat/dkstats.c +++ b/usr.bin/vmstat/dkstats.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dkstats.c,v 1.33 2007/11/26 09:28:34 martynas Exp $ */ +/* $OpenBSD: dkstats.c,v 1.34 2010/07/20 19:43:19 lum Exp $ */ /* $NetBSD: dkstats.c,v 1.1 1996/05/10 23:19:27 thorpej Exp $ */ /* @@ -431,28 +431,18 @@ dkinit(int sel) size_t size; struct clockinfo clkinfo; char *disknames, *name, *bufpp; - gid_t gid; if (once) return(1); - gid = getgid(); if (nlistf != NULL || memf != NULL) { #if !defined(NOKVM) - if (memf != NULL) - if (setresgid(gid, gid, gid) == -1) - err(1, "setresgid"); - /* Open the kernel. */ if (kd == NULL && (kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf)) == NULL) errx(1, "kvm_openfiles: %s", errbuf); - if (memf == NULL) - if (setresgid(gid, gid, gid) == -1) - err(1, "setresgid"); - /* Obtain the namelist symbols from the kernel. */ if (kvm_nlist(kd, namelist)) KVM_ERROR("kvm_nlist failed to read symbols."); 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; |