aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Meyering2011-09-24 11:22:06 +0200
committerJim Meyering2011-09-24 11:22:06 +0200
commitb260039d4257fae4594fbf13bc116ed154dec111 (patch)
treefe8aab0af4cd059aad1fdd28f835895c416deeef
parente488d29cecd63f466c3a27ce9970715e28c330da (diff)
downloademacs-b260039d4257fae4594fbf13bc116ed154dec111.tar.gz
emacs-b260039d4257fae4594fbf13bc116ed154dec111.zip
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)
-rw-r--r--src/ChangeLog15
-rw-r--r--src/emacs.c2
2 files changed, 16 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 44a76068313..7435254b490 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
12011-09-24 Jim Meyering <meyering@redhat.com>
2
3 do not ignore write error for any output size
4 The previous change was incomplete.
5 While it makes emacs --batch detect the vast majority of stdout
6 write failures, errors were still ignored whenever the output size is
7 k * (BUFSIZ+1) - 4. E.g., on a system with BUFSIZ of 4096,
8 $ emacs --batch --eval '(print (format "%4093d" 0))' > /dev/full \
9 && echo FAIL: ignored write error
10 FAIL: ignored write error
11 $ emacs --batch --eval '(print (format "%20481d" 0))' > /dev/full \
12 && echo FAIL: ignored write error
13 FAIL: ignored write error
14 * emacs.c (Fkill_emacs): Also test ferror. (Bug#9574)
15
12011-09-23 Andreas Schwab <schwab@linux-m68k.org> 162011-09-23 Andreas Schwab <schwab@linux-m68k.org>
2 17
3 * emacs.c (Fkill_emacs): In noninteractive mode exit 18 * emacs.c (Fkill_emacs): In noninteractive mode exit
diff --git a/src/emacs.c b/src/emacs.c
index 0a684d4423c..073156bb0c9 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -2019,7 +2019,7 @@ all of which are called before Emacs is actually killed. */)
2019 unlink (SSDATA (Vauto_save_list_file_name)); 2019 unlink (SSDATA (Vauto_save_list_file_name));
2020 2020
2021 exit_code = EXIT_SUCCESS; 2021 exit_code = EXIT_SUCCESS;
2022 if (noninteractive && fflush (stdout)) 2022 if (noninteractive && (fflush (stdout) || ferror (stdout)))
2023 exit_code = EXIT_FAILURE; 2023 exit_code = EXIT_FAILURE;
2024 exit (INTEGERP (arg) ? XINT (arg) : exit_code); 2024 exit (INTEGERP (arg) ? XINT (arg) : exit_code);
2025} 2025}