summaryrefslogtreecommitdiff
path: root/usr.bin/xargs/xargs.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-10 15:52:31 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-10 15:52:31 +0000
commited4b22fdfccaac2ca84dd08beba309748a84cc33 (patch)
treeae55690605b0177e3e8457ef5d97165f17fe72fd /usr.bin/xargs/xargs.c
parent1c5893c0209db85f19d70e4f9547352c29ab820c (diff)
pledge "stdio rpath proc exec". proc & exec because obviously it
spawns subprocesses. rpath is only needed for the -o (open /dev/tty) or no -o (open /dev/null) choice. ok beck
Diffstat (limited to 'usr.bin/xargs/xargs.c')
-rw-r--r--usr.bin/xargs/xargs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c
index ed0ada5138a..89d6c0b759d 100644
--- a/usr.bin/xargs/xargs.c
+++ b/usr.bin/xargs/xargs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xargs.c,v 1.29 2015/04/18 18:28:38 deraadt Exp $ */
+/* $OpenBSD: xargs.c,v 1.30 2015/10/10 15:52:30 deraadt Exp $ */
/* $FreeBSD: xargs.c,v 1.51 2003/05/03 19:09:11 obrien Exp $ */
/*-
@@ -104,6 +104,10 @@ main(int argc, char *argv[])
nargs = 5000;
if ((arg_max = sysconf(_SC_ARG_MAX)) == -1)
errx(1, "sysconf(_SC_ARG_MAX) failed");
+
+ if (pledge("stdio rpath proc exec", NULL) == -1)
+ err(1, "pledge");
+
nline = arg_max - 4 * 1024;
while (*ep != NULL) {
/* 1 byte for each '\0' */