]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* malloc/arena.c (ptmalloc_init): Don't use brk if dlopened cvs/fedora-glibc-2_3_3-69
authorJakub Jelinek <jakub@redhat.com>
Mon, 18 Oct 2004 11:56:08 +0000 (11:56 +0000)
committerJakub Jelinek <jakub@redhat.com>
Mon, 18 Oct 2004 11:56:08 +0000 (11:56 +0000)
from statically linked program and avoid calling _dl_addr in that
case.

ChangeLog
malloc/arena.c

index a282a288dbade57b0bcd429b5f71cf25641fae70..9978171580db946fa92e90baee7c3c774356b7a5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-10-18  Jakub Jelinek  <jakub@redhat.com>
+
+       * malloc/arena.c (ptmalloc_init): Don't use brk if dlopened
+       from statically linked program and avoid calling _dl_addr in that
+       case.
+
 2004-10-18  Jakub Jelinek  <jakub@redhat.com>
 
        * sysdeps/generic/strcpy_chk.c (__strcpy_chk): Speed up by checking
index 9018a4f0e9f3b871a09a282cbfb0cd7eb83c7c56..02e88a391ebbd645994ec218e0270913d035de84 100644 (file)
@@ -429,10 +429,16 @@ ptmalloc_init (void)
   main_arena.next = &main_arena;
 
 #if defined _LIBC && defined SHARED
-  /* In case this libc copy is in a non-default namespace, never use brk.  */
+  /* In case this libc copy is in a non-default namespace, never use brk.
+     Likewise if dlopened from statically linked program.  */
   Dl_info di;
   struct link_map *l;
-  if (_dl_addr (ptmalloc_init, &di, &l, NULL) != 0 && l->l_ns != LM_ID_BASE)
+  extern struct dl_open_hook *_dl_open_hook;
+  libc_hidden_proto (_dl_open_hook);
+
+  if (_dl_open_hook != NULL
+      || (_dl_addr (ptmalloc_init, &di, &l, NULL) != 0
+          && l->l_ns != LM_ID_BASE))
     __morecore = __failing_morecore;
 #endif