changeset 24418:882205f5e5b9

(main) [DOUG_LEA_MALLOC]: Don't use unsetenv, it calls malloc in glibc 2.1.
author Andreas Schwab <schwab@suse.de>
date Sun, 28 Feb 1999 02:12:07 +0000
parents 8a8615132482
children 30e478cd167e
files src/emacs.c
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/emacs.c	Sat Feb 27 04:28:31 1999 +0000
+++ b/src/emacs.c	Sun Feb 28 02:12:07 1999 +0000
@@ -571,8 +571,19 @@
       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 checking.  Can't use unsetenv, since that calls malloc.  */
+	{
+	  char **p;
+
+	  for (p = envp; *p; p++)
+	    if (strncmp (*p, "MALLOC_CHECK_=", 14) == 0)
+	      {
+		do
+		  *p = p[1];
+		while (*++p);
+		break;
+	      }
+	}
       malloc_set_state (malloc_state_ptr);
       free (malloc_state_ptr);
     }