From 669764169e6c178341b11ebab8f1885b74e310db Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 14 Jan 2015 21:27:17 +0000 Subject: if earlier files set a non-zero exit status, do not allow later files to reset it to zero --- main.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 010dfaa4..5bd99a53 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.213 2015/01/13 23:17:52 schwarze Exp $ */ +/* $Id: main.c,v 1.214 2015/01/14 21:27:17 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze @@ -131,7 +131,7 @@ main(int argc, char *argv[]) int prio, best_prio, synopsis_only; char sec; #endif - enum mandoclevel rc; + enum mandoclevel rc, rctmp; enum outmode outmode; int fd; int show_usage; @@ -431,11 +431,13 @@ main(int argc, char *argv[]) } while (argc) { - rc = mparse_open(curp.mp, &fd, + rctmp = mparse_open(curp.mp, &fd, #if HAVE_SQLITE3 resp != NULL ? resp->file : #endif *argv); + if (rc < rctmp) + rc = rctmp; if (fd != -1) { if (use_pager && isatty(STDOUT_FILENO)) @@ -451,13 +453,17 @@ main(int argc, char *argv[]) /* For .so only; ignore failure. */ chdir(paths.paths[resp->ipath]); parse(&curp, fd, resp->file, &rc); - } else - rc = passthrough(resp->file, fd, + } else { + rctmp = passthrough(resp->file, fd, synopsis_only); + if (rc < rctmp) + rc = rctmp; + } #endif - if (mparse_wait(curp.mp) != MANDOCLEVEL_OK) - rc = MANDOCLEVEL_SYSERR; + rctmp = mparse_wait(curp.mp); + if (rc < rctmp) + rc = rctmp; if (argc > 1 && curp.outtype <= OUTT_UTF8) ascii_sepline(curp.outdata); -- cgit v1.2.3-56-ge451