# uses pledge() --- src/main.c.orig Thu Nov 20 21:12:54 2014 +++ src/main.c Fri Mar 25 11:45:40 2016 @@ -56,6 +56,7 @@ #ifdef HAVE_GETOPT_LONG #include #endif +#include /* defaults for unset environment variables */ #define EDITOR "vi" @@ -481,6 +482,14 @@ cscope: reffile too long, cannot be > %d characters\n" lastarg: #endif + + if (linemode == YES) { + if (pledge("stdio rpath wpath cpath proc exec", NULL) == -1) { + fprintf(stderr, "cscope: pledge: %s\n", strerror(errno)); + myexit(1); + } + } + /* read the environment */ editor = mygetenv("EDITOR", EDITOR); editor = mygetenv("VIEWER", editor); /* use viewer if set */ @@ -573,6 +582,12 @@ cscope: Could not create private temp dir %s\n", /* initialize the curses display package */ initscr(); /* initialize the screen */ entercurses(); + + if (pledge("stdio rpath wpath cpath tty proc exec", NULL) == -1) { + fprintf(stderr, "cscope: pledge: %s\n", strerror(errno)); + myexit(1); + } + #if TERMINFO keypad(stdscr, TRUE); /* enable the keypad */ # ifdef HAVE_FIXKEYPAD