summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-23 03:26:25 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-23 03:26:25 +0000
commit06f6ed3b75bb3285267d48dbe0c8ad6305278073 (patch)
tree3a2e14feda2d9927390856e471edea8be0e8d3a1 /usr.bin
parent8b596664254048f8e38be8c8dd86709774d7e0f5 (diff)
With new pledge "ps" and "vminfo" requests, ps/top/w become possible.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/top/top.c5
-rw-r--r--usr.bin/w/w.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c
index aa2f49bfb0d..a6d4fcaf3b5 100644
--- a/usr.bin/top/top.c
+++ b/usr.bin/top/top.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: top.c,v 1.83 2015/05/06 07:53:29 mpi Exp $ */
+/* $OpenBSD: top.c,v 1.84 2015/10/23 03:26:24 deraadt Exp $ */
/*
* Top users/processes display for Unix
@@ -328,6 +328,9 @@ main(int argc, char *argv[])
preset_argc = 0;
} while (i != 0);
+ if (pledge("abort stdio rpath tty ps vminfo", NULL) == -1)
+ err(1, "pledge");
+
/* set constants for username/uid display correctly */
if (!do_unames) {
uname_field = " UID ";
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index 762566a7675..596b2b48194 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: w.c,v 1.59 2015/08/31 15:49:34 deraadt Exp $ */
+/* $OpenBSD: w.c,v 1.60 2015/10/23 03:26:24 deraadt Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -112,6 +112,9 @@ main(int argc, char *argv[])
char *memf, *nlistf, *p, *x;
char buf[HOST_NAME_MAX+1], errbuf[_POSIX2_LINE_MAX];
+ if (pledge("stdio tty rpath ps vminfo", NULL) == -1)
+ err(1, "pledge");
+
/* Are we w(1) or uptime(1)? */
p = __progname;
if (*p == '-')