]> git.eshelyaron.com Git - emacs.git/commitdiff
do not ignore write error for any output size
authorJim Meyering <meyering@redhat.com>
Sat, 24 Sep 2011 09:22:06 +0000 (11:22 +0200)
committerJim Meyering <meyering@redhat.com>
Sat, 24 Sep 2011 09:22:06 +0000 (11:22 +0200)
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)

src/ChangeLog
src/emacs.c

index 44a76068313ad2129dab1b4fde506b56b94889c2..7435254b4908c3bcf71ca286ff52df135931ce7c 100644 (file)
@@ -1,3 +1,18 @@
+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
index 0a684d4423c395727039ac2c33c6129f9494d057..073156bb0c96d684f9583a6130a73415b7c40f59 100644 (file)
@@ -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);
 }