summaryrefslogtreecommitdiff
path: root/src/emacs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emacs.c')
-rw-r--r--src/emacs.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/emacs.c b/src/emacs.c
index 537574d93ab..ec17322f57a 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -127,6 +127,8 @@ extern int malloc_set_state (void*);
/* True if the MALLOC_CHECK_ environment variable was set while
dumping. Used to work around a bug in glibc's malloc. */
static bool malloc_using_checking;
+#elif defined HAVE_PTHREAD && !defined SYSTEM_MALLOC
+extern void malloc_enable_thread (void);
#endif
Lisp_Object Qfile_name_handler_alist;
@@ -302,6 +304,13 @@ bool fatal_error_in_progress;
static void *ns_pool;
#endif
+#if !HAVE_SETLOCALE
+static char *
+setlocale (int cat, char const *locale)
+{
+ return 0;
+}
+#endif
/* Report a fatal error due to signal SIG, output a backtrace of at
@@ -1056,13 +1065,15 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
#endif /* DOS_NT */
}
-#if defined (HAVE_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC)
- if (! noninteractive)
- {
- extern void malloc_enable_thread (void);
-
- malloc_enable_thread ();
- }
+#if defined HAVE_PTHREAD && !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC
+# ifndef CANNOT_DUMP
+ /* Do not make gmalloc thread-safe when creating bootstrap-emacs, as
+ that causes an infinite recursive loop with FreeBSD. But do make
+ it thread-safe when creating emacs, otherwise bootstrap-emacs
+ fails on Cygwin. See Bug#14569. */
+ if (!noninteractive || initialized)
+# endif
+ malloc_enable_thread ();
#endif
init_signals (dumping);
@@ -1849,7 +1860,11 @@ all of which are called before Emacs is actually killed. */)
kill it because we are exiting Emacs deliberately (not crashing).
Do it after shut_down_emacs, which does an auto-save. */
if (STRINGP (Vauto_save_list_file_name))
- unlink (SSDATA (Vauto_save_list_file_name));
+ {
+ Lisp_Object listfile;
+ listfile = Fexpand_file_name (Vauto_save_list_file_name, Qnil);
+ unlink (SSDATA (listfile));
+ }
if (INTEGERP (arg))
exit_code = (XINT (arg) < 0
@@ -2213,7 +2228,7 @@ from the parent process and its tty file descriptors. */)
error ("This function can only be called after loading the init files");
/* Get rid of stdin, stdout and stderr. */
- nfd = open ("/dev/null", O_RDWR);
+ nfd = emacs_open ("/dev/null", O_RDWR, 0);
err |= nfd < 0;
err |= dup2 (nfd, 0) < 0;
err |= dup2 (nfd, 1) < 0;