=================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.300 retrieving revision 1.302 diff -u -p -r1.300 -r1.302 --- mandoc/main.c 2017/07/20 15:26:41 1.300 +++ mandoc/main.c 2017/08/21 15:42:58 1.302 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.300 2017/07/20 15:26:41 schwarze Exp $ */ +/* $Id: main.c,v 1.302 2017/08/21 15:42:58 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014-2017 Ingo Schwarze @@ -478,11 +478,22 @@ main(int argc, char *argv[]) parse(&curp, fd, *argv); else if (resp->form == FORM_SRC) { /* For .so only; ignore failure. */ - chdir(conf.manpath.paths[resp->ipath]); + (void)chdir(conf.manpath.paths[resp->ipath]); parse(&curp, fd, resp->file); } else passthrough(resp->file, fd, conf.output.synopsisonly); + + if (ferror(stdout)) { + if (tag_files != NULL) { + warn("%s", tag_files->ofn); + tag_unlink(); + tag_files = NULL; + } else + warn("stdout"); + rc = MANDOCLEVEL_SYSERR; + break; + } if (argc > 1 && curp.outtype <= OUTT_UTF8) { if (curp.outdata == NULL)