summaryrefslogtreecommitdiffstats
path: root/usr.sbin/iostat
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2019-10-14 19:22:17 +0000
committerderaadt <deraadt@openbsd.org>2019-10-14 19:22:17 +0000
commitdfb25bdd5c3923791610351b01f96d9c013861ca (patch)
treef270ef9d3decf3f3ed0da3a4e3dbec90ab2bb05a /usr.sbin/iostat
parentRe-sort the if-sequence which sets COMPILER_VERSION to be the same (diff)
downloadwireguard-openbsd-dfb25bdd5c3923791610351b01f96d9c013861ca.tar.xz
wireguard-openbsd-dfb25bdd5c3923791610351b01f96d9c013861ca.zip
pledge() won't work but we can use unveil() to reduce filesystem access
in these 3 related programs (they borrow parts of each other using .PATH) Hopefully no regressions, ktrace checks by myself and mestre
Diffstat (limited to 'usr.sbin/iostat')
-rw-r--r--usr.sbin/iostat/iostat.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c
index 70a00fe5278..9384c3e47bc 100644
--- a/usr.sbin/iostat/iostat.c
+++ b/usr.sbin/iostat/iostat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iostat.c,v 1.41 2018/09/05 09:35:49 yasuoka Exp $ */
+/* $OpenBSD: iostat.c,v 1.42 2019/10/14 19:22:17 deraadt Exp $ */
/* $NetBSD: iostat.c,v 1.10 1996/10/25 18:21:58 scottr Exp $ */
/*
@@ -161,6 +161,12 @@ main(int argc, char *argv[])
todo |= SHOW_CPU | SHOW_TTY | SHOW_STATS_1;
dkinit(0);
+
+ if (unveil("/", "") == -1)
+ err(1, "unveil");
+ if (unveil(NULL, NULL) == -1)
+ err(1, "unveil");
+
dkreadstats();
selectdrives(argv);