* emacs.c (close_output_streams): Use strerror, not emacs_strerror,
as we can't assume that emacs_strerror is initialized, and strerror
is good enough here.
(main): Invoke atexit earlier, to catch earlier instances of
sending data to stdout and exiting, e.g., "emacs --version >/dev/full".
Fixes: debbugs:9574
+2012-11-04 Paul Eggert <eggert@cs.ucla.edu>
+
+ Fix data-loss with --version (Bug#9574).
+ * emacs.c (close_output_streams): Use strerror, not emacs_strerror,
+ as we can't assume that emacs_strerror is initialized, and strerror
+ is good enough here.
+ (main): Invoke atexit earlier, to catch earlier instances of
+ sending data to stdout and exiting, e.g., "emacs --version >/dev/full".
+
2012-11-04 Michael Marchionna <tralfaz@pacbell.net>
* nsterm.m: Add NSClearLineFunctionKey and keypad keys (Bug#8680).
if (close_stream (stdout) != 0)
{
fprintf (stderr, "Write error to standard output: %s\n",
- emacs_strerror (errno));
+ strerror (errno));
fflush (stderr);
_exit (EXIT_FAILURE);
}
unexec_init_emacs_zone ();
#endif
+ atexit (close_output_streams);
+
sort_args (argc, argv);
argc = 0;
while (argv[argc]) argc++;
if (do_initial_setlocale)
setlocale (LC_ALL, "");
- atexit (close_output_streams);
-
inhibit_window_system = 0;
/* Handle the -t switch, which specifies filename to use as terminal. */