Commit b260039d authored by Jim Meyering's avatar Jim Meyering
Browse files

do not ignore write error for any output size

The previous change was incomplete.
While it makes emacs --batch detect the vast majority of stdout
write failures, errors were still ignored whenever the output size is
k * (BUFSIZ+1) - 4.  E.g., on a system with BUFSIZ of 4096,
  $ emacs --batch --eval '(print (format "%4093d" 0))' > /dev/full \
      && echo FAIL: ignored write error
  FAIL: ignored write error
  $ emacs --batch --eval '(print (format "%20481d" 0))' > /dev/full \
      && echo FAIL: ignored write error
  FAIL: ignored write error
* emacs.c (Fkill_emacs): Also test ferror.  (Bug#9574)
parent e488d29c
2011-09-24 Jim Meyering <meyering@redhat.com>
do not ignore write error for any output size
The previous change was incomplete.
While it makes emacs --batch detect the vast majority of stdout
write failures, errors were still ignored whenever the output size is
k * (BUFSIZ+1) - 4. E.g., on a system with BUFSIZ of 4096,
$ emacs --batch --eval '(print (format "%4093d" 0))' > /dev/full \
&& echo FAIL: ignored write error
FAIL: ignored write error
$ emacs --batch --eval '(print (format "%20481d" 0))' > /dev/full \
&& echo FAIL: ignored write error
FAIL: ignored write error
* emacs.c (Fkill_emacs): Also test ferror. (Bug#9574)
2011-09-23 Andreas Schwab <schwab@linux-m68k.org>
* emacs.c (Fkill_emacs): In noninteractive mode exit
......
......@@ -2019,7 +2019,7 @@ all of which are called before Emacs is actually killed. */)
unlink (SSDATA (Vauto_save_list_file_name));
exit_code = EXIT_SUCCESS;
if (noninteractive && fflush (stdout))
if (noninteractive && (fflush (stdout) || ferror (stdout)))
exit_code = EXIT_FAILURE;
exit (INTEGERP (arg) ? XINT (arg) : exit_code);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment