* mandoc: When the stdout stream gets broken, there is no point in reading
@ 2017-08-21 15:43 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-08-21 15:43 UTC (permalink / raw)
To: source
Log Message:
-----------
When the stdout stream gets broken, there is no point in reading
any more input files, and it would be misleading to start a parser,
because that would show randomly truncated text.
Instead, print an error message and exit the program.
Issue found by Leah Neukirchen <leah at vuxu dot org>, who was
surprised to see half a manpage when her /tmp/ overflew.
Modified Files:
--------------
mandoc:
main.c
Revision Data
-------------
Index: main.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/main.c,v
retrieving revision 1.301
retrieving revision 1.302
diff -Lmain.c -Lmain.c -u -p -r1.301 -r1.302
--- main.c
+++ main.c
@@ -484,6 +484,17 @@ main(int argc, char *argv[])
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)
outdata_alloc(&curp);
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-08-21 15:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-21 15:43 mandoc: When the stdout stream gets broken, there is no point in reading schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).