summaryrefslogtreecommitdiff
path: root/usr.bin/systat
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-10-14 19:22:18 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-10-14 19:22:18 +0000
commite0f954bbd2214f8e2a6e175df2e8819072944c0d (patch)
tree976a785c7af5bcccc02ade87f65804ce1bde5858 /usr.bin/systat
parent75e733194e284b1e61644f833693d214ef0ce689 (diff)
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.bin/systat')
-rw-r--r--usr.bin/systat/main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c
index 7df80a19c3a..09e9f77506b 100644
--- a/usr.bin/systat/main.c
+++ b/usr.bin/systat/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.70 2019/06/28 13:35:04 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.71 2019/10/14 19:22:17 deraadt Exp $ */
/*
* Copyright (c) 2001, 2007 Can Erkin Acar
* Copyright (c) 2001 Daniel Hartmeier
@@ -526,6 +526,11 @@ main(int argc, char *argv[])
setup_term(maxlines);
+ if (unveil("/", "r") == -1)
+ err(1, "unveil");
+ if (unveil(NULL, NULL) == -1)
+ err(1, "unveil");
+
if (rawmode && countmax == 0)
countmax = 1;