emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105896: do not ignore write error fo


From: Jim Meyering
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105896: do not ignore write error for any output size
Date: Sat, 24 Sep 2011 11:22:06 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105896
committer: Jim Meyering <address@hidden>
branch nick: trunk
timestamp: Sat 2011-09-24 11:22:06 +0200
message:
  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)
modified:
  src/ChangeLog
  src/emacs.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-09-23 09:56:55 +0000
+++ b/src/ChangeLog     2011-09-24 09:22:06 +0000
@@ -1,3 +1,18 @@
+2011-09-24  Jim Meyering  <address@hidden>
+
+       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  <address@hidden>
 
        * emacs.c (Fkill_emacs): In noninteractive mode exit

=== modified file 'src/emacs.c'
--- a/src/emacs.c       2011-09-23 09:56:55 +0000
+++ b/src/emacs.c       2011-09-24 09:22:06 +0000
@@ -2019,7 +2019,7 @@
     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);
 }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]