openbsd-ports/devel/cscope/patches/patch-src_main_c
mestre 6c71c67982 The first #ifdef around pledge was totally wrong and this way this pledge was
never called. This problem was pointed out by jca@ a big thank you!
As upstream doesn't seem to be active anymore both #ifdefs around the pledges
can go away.

OK tb@
2016-03-25 12:41:56 +00:00

43 lines
1.1 KiB
Plaintext

$OpenBSD: patch-src_main_c,v 1.2 2016/03/25 12:41:56 mestre Exp $
# 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 <getopt.h>
#endif
+#include <errno.h>
/* 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