From: David Levine Date: Sun, 28 Oct 2018 18:27:39 +0000 (-0400) Subject: scan(1) now checks for full output device [Bug #50925]. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/f54674f1b5d07148d9655fc3b337ad5f725272a7 scan(1) now checks for full output device [Bug #50925]. Added fflush(3) after every output line: may slow down scan on output with large number of lines. --- diff --git a/docs/pending-release-notes b/docs/pending-release-notes index 138a909b..4623da54 100644 --- a/docs/pending-release-notes +++ b/docs/pending-release-notes @@ -19,3 +19,4 @@ DEPRECATED FEATURES BUG FIXES --------- +- scan(1) now checks for full output device [Bug #50925]. \ No newline at end of file diff --git a/test/scan/test-scan b/test/scan/test-scan index 00e383cb..510ad36a 100755 --- a/test/scan/test-scan +++ b/test/scan/test-scan @@ -39,6 +39,15 @@ run_prog scan +inbox -width 80 >"$actual" || exit 1 check "$expected" "$actual" +# check full output device, if one exists +if test -c /dev/full; then + start_test 'full output device' + printf 'scan: failed to fflush stdout: No space left on device\n' >"$expected" + scan last >/dev/full 2>"$actual" && false + check "$expected" "$actual" +fi + + # check highlighting start_test 'highlighting' cat >"$expected" <c_text = saved_c_text; - if (noisy) - fputs (charstring_buffer (*scanl), stdout); + if (noisy) { + if (fputs (charstring_buffer (*scanl), stdout) == EOF) { + adios("stdout", "failed to fputs"); + } + if (fflush (stdout)) { + adios("stdout", "failed to fflush"); + } + } cptr = fmt_findcomp ("encrypted"); encrypted = cptr && cptr->c_text;