]> git.eshelyaron.com Git - emacs.git/commitdiff
* emacs.c (shut_down_emacs): Don't assume stderr is buffered,
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 22 Sep 2012 07:34:52 +0000 (00:34 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 22 Sep 2012 07:34:52 +0000 (00:34 -0700)
or that fprintf is async-signal-safe.  POSIX doesn't require
either assumption.

src/ChangeLog
src/emacs.c

index 439b5c06e277bbaee37cfd2b4d34a3e50c37b2e1..847e065e1c384cd410ec11890ac846fc96c118ca 100644 (file)
@@ -1,3 +1,9 @@
+2012-09-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * emacs.c (shut_down_emacs): Don't assume stderr is buffered,
+       or that fprintf is async-signal-safe.  POSIX doesn't require
+       either assumption.
+
 2012-09-22  Chong Yidong  <cyd@gnu.org>
 
        * buffer.c (Fset_buffer_modified_p): Handle indirect buffers
index d4b52ab64ea80eccaa32342b0273b6ae07173cac..a483f3848cf0e5336baedfc4e16cbe4341de7e7b 100644 (file)
@@ -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