On Sun, Nov 29, 2015 at 03:00:13PM +0100, Theo Buehler wrote: > Fairly straightforward pledge for cribbage: > > It might fork-exec a pager ($PAGER or more(1)) in instructions() > afterwards only "stdio tty" is needed.
I sent a slightly older version of the patch... Here's what I actually wanted to do: move the second pledge call a bit down, but call it in all code paths. Note: I'll stop the spam for now, but I have updates for battlestar(6) and atc(6) in the pipeline. Index: games/cribbage/crib.c =================================================================== RCS file: /cvs/src/games/cribbage/crib.c,v retrieving revision 1.18 diff -u -p -r1.18 crib.c --- games/cribbage/crib.c 12 Mar 2015 02:19:10 -0000 1.18 +++ games/cribbage/crib.c 29 Nov 2015 14:13:25 -0000 @@ -49,6 +49,9 @@ main(int argc, char *argv[]) bool playing; int ch; + if(pledge("stdio rpath tty proc exec", NULL) == -1) + err(1, "pledge"); + while ((ch = getopt(argc, argv, "emqr")) != -1) switch (ch) { case 'e': @@ -99,6 +102,10 @@ main(int argc, char *argv[]) msg("For cribbage rules, use \"man cribbage\""); } } + + if (pledge("stdio tty", NULL) == -1) + err(1, "pledge"); + playing = TRUE; do { wclrtobot(Msgwin); Index: games/cribbage/instr.c =================================================================== RCS file: /cvs/src/games/cribbage/instr.c,v retrieving revision 1.11 diff -u -p -r1.11 instr.c --- games/cribbage/instr.c 27 Oct 2009 23:59:24 -0000 1.11 +++ games/cribbage/instr.c 29 Nov 2015 14:13:25 -0000 @@ -64,7 +64,6 @@ instructions(void) err(1, "vfork"); /* NOTREACHED */ case 0: - setgid(getgid()); if (!isatty(1)) pager = "/bin/cat"; else {