summaryrefslogtreecommitdiff
path: root/src/emacs.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-09-22 00:34:52 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-09-22 00:34:52 -0700
commit01108e3f4567db222a7e6e2ed9c484506b491dba (patch)
tree7d9e97fc0ec3c59d980d94421dd18fd8a71805fb /src/emacs.c
parent471333800df6aefbdc4044a39b1808c1d01404d5 (diff)
downloademacs-01108e3f4567db222a7e6e2ed9c484506b491dba.tar.gz
* emacs.c (shut_down_emacs): Don't assume stderr is buffered,
or that fprintf is async-signal-safe. POSIX doesn't require either assumption.
Diffstat (limited to 'src/emacs.c')
-rw-r--r--src/emacs.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/emacs.c b/src/emacs.c
index d4b52ab64ea..a483f3848cf 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -27,6 +27,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <sys/file.h>
#include <unistd.h>
+#include <ignore-value.h>
+
#include "lisp.h"
#ifdef HAVE_WINDOW_SYSTEM
@@ -2012,7 +2014,12 @@ shut_down_emacs (int sig, Lisp_Object stuff)
{
reset_all_sys_modes ();
if (sig && sig != SIGTERM)
- fprintf (stderr, "Fatal error %d: %s", sig, strsignal (sig));
+ {
+ char buf[100];
+ int buflen = snprintf (buf, sizeof buf, "Fatal error %d: %s",
+ sig, strsignal (sig));
+ ignore_value (write (STDERR_FILENO, buf, buflen));
+ }
}
}
#else