In both code paths, openpartition() will call opendev after pledge was
called. Just leave the "stdio" promise afterwards.

Index: tunefs.c
===================================================================
RCS file: /var/cvs/src/sbin/tunefs/tunefs.c,v
retrieving revision 1.40
diff -u -p -r1.40 tunefs.c
--- tunefs.c    9 Dec 2015 01:08:31 -0000       1.40
+++ tunefs.c    28 May 2016 22:58:40 -0000
@@ -147,14 +147,6 @@ main(int argc, char *argv[])
        if (argc != 1)
                usage();
 
-       if (Nflag) {
-               if (pledge("stdio rpath disklabel", NULL) == -1)
-                       err(1, "pledge");
-       } else {
-               if (pledge("stdio rpath wpath disklabel", NULL) == -1)
-                       err(1, "pledge");
-       }
-
        special = argv[0];
        openflags = Nflag ? O_RDONLY : O_RDWR;
        if (Fflag)

Reply via email to