aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--main.c17
-rw-r--r--mandocdb.c21
2 files changed, 23 insertions, 15 deletions
diff --git a/main.c b/main.c
index 09dbfbe2..a311eb93 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.259 2015/11/20 21:59:54 schwarze Exp $ */
+/* $Id: main.c,v 1.260 2015/12/15 17:38:45 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -299,8 +299,9 @@ main(int argc, char *argv[])
use_pager = 0;
#if HAVE_PLEDGE
- if (!use_pager && pledge("stdio rpath flock", NULL) == -1)
- err((int)MANDOCLEVEL_SYSERR, "pledge");
+ if (!use_pager)
+ if (pledge("stdio rpath flock", NULL) == -1)
+ err((int)MANDOCLEVEL_SYSERR, "pledge");
#endif
/* Parse arguments. */
@@ -430,9 +431,13 @@ main(int argc, char *argv[])
/* mandoc(1) */
#if HAVE_PLEDGE
- if (pledge(use_pager ? "stdio rpath tmppath tty proc exec" :
- "stdio rpath", NULL) == -1)
- err((int)MANDOCLEVEL_SYSERR, "pledge");
+ if (use_pager) {
+ if (pledge("stdio rpath tmppath tty proc exec", NULL) == -1)
+ err((int)MANDOCLEVEL_SYSERR, "pledge");
+ } else {
+ if (pledge("stdio rpath", NULL) == -1)
+ err((int)MANDOCLEVEL_SYSERR, "pledge");
+ }
#endif
if (search.argmode == ARG_FILE && ! moptions(&options, auxpaths))
diff --git a/mandocdb.c b/mandocdb.c
index 8b45083c..04ba1acf 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.209 2015/11/07 17:58:55 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.210 2015/12/15 17:38:45 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -420,9 +420,11 @@ mandocdb(int argc, char *argv[])
argv += optind;
#if HAVE_PLEDGE
- if (nodb && pledge("stdio rpath", NULL) == -1) {
- perror("pledge");
- return (int)MANDOCLEVEL_SYSERR;
+ if (nodb) {
+ if (pledge("stdio rpath", NULL) == -1) {
+ perror("pledge");
+ return (int)MANDOCLEVEL_SYSERR;
+ }
}
#endif
@@ -452,11 +454,12 @@ mandocdb(int argc, char *argv[])
* all files specified on the command-line.
*/
#if HAVE_PLEDGE
- if (!nodb && pledge("stdio rpath wpath cpath fattr flock",
- NULL) == -1) {
- perror("pledge");
- exitcode = (int)MANDOCLEVEL_SYSERR;
- goto out;
+ if (!nodb) {
+ if (pledge("stdio rpath wpath cpath fattr flock", NULL) == -1) {
+ perror("pledge");
+ exitcode = (int)MANDOCLEVEL_SYSERR;
+ goto out;
+ }
}
#endif
use_all = 1;