diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-01-14 21:27:17 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-01-14 21:27:17 +0000 |
commit | b4dc7abb73518820b5be9949b77b4bca86da3c42 (patch) | |
tree | a1edc08d937da8c6c3ecbd87ad820f5f66311234 | |
parent | 896f51b44eebc52329f94c2e14d065f1f91b668c (diff) | |
download | mandoc-b4dc7abb73518820b5be9949b77b4bca86da3c42.tar.gz |
if earlier files set a non-zero exit status,
do not allow later files to reset it to zero
-rw-r--r-- | main.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -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); |