This straightforward pledge("stdio") is one of the last uncommitted ones
from Theo's big 'tame in userland' diff and seems to have been
overlooked so far.

Index: usr.bin/arch/arch.c
===================================================================
RCS file: /cvs/src/usr.bin/arch/arch.c,v
retrieving revision 1.16
diff -u -p -r1.16 arch.c
--- usr.bin/arch/arch.c 25 Sep 2015 16:19:26 -0000      1.16
+++ usr.bin/arch/arch.c 13 Nov 2015 13:32:35 -0000
@@ -30,6 +30,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <err.h>
 
 static void __dead usage(void);
 
@@ -43,6 +44,9 @@ main(int argc, char *argv[])
        char *arch, *opts;
 
        setlocale(LC_ALL, "");
+
+       if (pledge("stdio", NULL) == -1)
+               err(1, "pledge");
 
        machine = strcmp(__progname, "machine") == 0;
        if (machine) {

Reply via email to