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@
This commit is contained in:
mestre 2016-03-25 12:41:56 +00:00
parent fb40da4e25
commit 6c71c67982
2 changed files with 6 additions and 10 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.19 2016/01/21 14:34:42 mestre Exp $
# $OpenBSD: Makefile,v 1.20 2016/03/25 12:41:56 mestre Exp $
COMMENT = code browsing program
DISTNAME = cscope-15.8b
REVISION = 0
REVISION = 1
CATEGORIES = devel
HOMEPAGE = http://cscope.sourceforge.net/

View File

@ -1,9 +1,9 @@
$OpenBSD: patch-src_main_c,v 1.1 2016/01/21 14:34:42 mestre Exp $
$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 Tue Jan 19 10:27:48 2016
+++ src/main.c Fri Mar 25 11:45:40 2016
@@ -56,6 +56,7 @@
#ifdef HAVE_GETOPT_LONG
#include <getopt.h>
@ -12,34 +12,30 @@ $OpenBSD: patch-src_main_c,v 1.1 2016/01/21 14:34:42 mestre Exp $
/* defaults for unset environment variables */
#define EDITOR "vi"
@@ -481,6 +482,16 @@ cscope: reffile too long, cannot be > %d characters\n"
@@ -481,6 +482,14 @@ cscope: reffile too long, cannot be > %d characters\n"
lastarg:
#endif
+
+#if defined(__OPENBSD__)
+ if (linemode == YES) {
+ if (pledge("stdio rpath wpath cpath proc exec", NULL) == -1) {
+ fprintf(stderr, "cscope: pledge: %s\n", strerror(errno));
+ myexit(1);
+ }
+ }
+#endif
+
/* read the environment */
editor = mygetenv("EDITOR", EDITOR);
editor = mygetenv("VIEWER", editor); /* use viewer if set */
@@ -573,6 +584,14 @@ cscope: Could not create private temp dir %s\n",
@@ -573,6 +582,12 @@ cscope: Could not create private temp dir %s\n",
/* initialize the curses display package */
initscr(); /* initialize the screen */
entercurses();
+
+#if defined(__OpenBSD__)
+ if (pledge("stdio rpath wpath cpath tty proc exec", NULL) == -1) {
+ fprintf(stderr, "cscope: pledge: %s\n", strerror(errno));
+ myexit(1);
+ }
+#endif
+
#if TERMINFO
keypad(stdscr, TRUE); /* enable the keypad */