summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>1999-02-26 09:23:52 +0000
committerAndreas Schwab <schwab@suse.de>1999-02-26 09:23:52 +0000
commit7c9cd4467d6c3f55dbd8c1fa4f2de5db6494034f (patch)
treeea70a0881ddd570c1a9109f4a3ebfbb724e5856e
parent53fe786d1f59804bf1f6f61d0a9492ff1d1ce3a8 (diff)
downloademacs-7c9cd4467d6c3f55dbd8c1fa4f2de5db6494034f.tar.gz
(main) [DOUG_LEA_MALLOC]: Work around a bug in glibc's
malloc.
-rw-r--r--src/emacs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/emacs.c b/src/emacs.c
index 40c1b16f745..956abe97b86 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -103,6 +103,9 @@ void *malloc_state_ptr;
extern void *malloc_get_state ();
/* From glibc, a routine that overwrites the malloc internal state. */
extern void malloc_set_state ();
+/* Non-zero if the MALLOC_CHECK_ enviroment variable was set while
+ dumping. Used to work around a bug in glibc's malloc. */
+int malloc_using_checking;
#endif
/* Variable whose value is symbol giving operating system type. */
@@ -565,9 +568,16 @@ main (argc, argv, envp)
#ifdef DOUG_LEA_MALLOC
if (initialized)
{
+ if (!malloc_using_checking)
+ /* Work around a bug in glibc's malloc. MALLOC_CHECK_ must be
+ ignored if the heap to be restored was constructed without
+ malloc checking. */
+ unsetenv ("MALLOC_CHECK_");
malloc_set_state (malloc_state_ptr);
free (malloc_state_ptr);
}
+ else
+ malloc_using_checking = getenv ("MALLOC_CHECK_") != NULL;
#endif
#ifdef RUN_TIME_REMAP