]> git.eshelyaron.com Git - emacs.git/commitdiff
(main) [DOUG_LEA_MALLOC]: Don't use unsetenv, it calls
authorAndreas Schwab <schwab@suse.de>
Sun, 28 Feb 1999 02:12:07 +0000 (02:12 +0000)
committerAndreas Schwab <schwab@suse.de>
Sun, 28 Feb 1999 02:12:07 +0000 (02:12 +0000)
malloc in glibc 2.1.

src/emacs.c

index 956abe97b862f0009745231dbdde760a325ef11c..667b1db267bbeeac1fe8b1769fe8cef0452cec72 100644 (file)
@@ -571,8 +571,19 @@ main (argc, argv, envp)
       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);
     }