aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-01-14 21:27:17 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-01-14 21:27:17 +0000
commit669764169e6c178341b11ebab8f1885b74e310db (patch)
treeb4e4f532d151edf0c4ae7df5b72544f084f257ac /main.c
parent0d50b9e383e73e242a3599c206cf0f220d72b239 (diff)
downloadmandoc-669764169e6c178341b11ebab8f1885b74e310db.tar.gz
mandoc-669764169e6c178341b11ebab8f1885b74e310db.tar.zst
mandoc-669764169e6c178341b11ebab8f1885b74e310db.zip
if earlier files set a non-zero exit status,
do not allow later files to reset it to zero
Diffstat (limited to 'main.c')
-rw-r--r--main.c20
1 files changed, 13 insertions, 7 deletions
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 <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -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);