From ca35b64c186e9f750585635c5a31090aa82976c9 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 15 Dec 2015 17:38:45 +0000 Subject: pledge(2) style: Make sure to always use the idiom 'if (pledge("' such that it can easily be searched for. No functional change. Requested by deraadt@ some time ago. --- main.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'main.c') 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 * Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze @@ -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)) -- cgit v1.2.3