diff options
author | Ulrich Drepper <drepper@redhat.com> | 1996-08-12 02:44:03 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1996-08-12 02:44:03 +0000 |
commit | a8874eadae699b5d4583aab3a860e06ecfcf5e5a (patch) | |
tree | 5165cfc605b53e459cc641ce9c2e614619ee867f /sysdeps/generic | |
parent | a3e59be8d1e0dbb1d2ab25c3dc4b0ad04e159ad2 (diff) | |
download | glibc-a8874eadae699b5d4583aab3a860e06ecfcf5e5a.tar.gz |
Last minute change.cvs/libc-ud-960811-2
Mon Aug 12 04:33:09 1996 Ulrich Drepper <drepper@cygnus.com>
* nss/nsswitch.c (__nss_database_lookup): Always release locks
before returning. Reported by Miles Bader.
(distributes): Add databases.def.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/sbrk.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sysdeps/generic/sbrk.c b/sysdeps/generic/sbrk.c index 698f814e2b..92ad8c4102 100644 --- a/sysdeps/generic/sbrk.c +++ b/sysdeps/generic/sbrk.c @@ -22,6 +22,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ extern void *__curbrk; extern int __brk (void *addr); +#ifdef PIC +extern int __libc_is_static; +weak_extern (__libc_is_static) +#endif + /* Extend the process's data space by INCREMENT. If INCREMENT is negative, shrink data space by - INCREMENT. Return start of new space allocated, or -1 for errors. */ @@ -30,12 +35,16 @@ __sbrk (ptrdiff_t increment) { void *oldbrk; - /* Always update __curbrk from the kernel's brk value. That way two - separate instances of __brk and __sbrk can share the heap, returning - interleaved pieces of it. This happens when libc.so is loaded by - dlopen in a statically-linked program that already uses __brk. */ - if (__brk (0) < 0) - return (void *) -1; + /* If this is not part of the dynamic library or the library is used + via dynamic loading in a statically linked program update + __curbrk from the kernel's brk value. That way two separate + instances of __brk and __sbrk can share the heap, returning + interleaved pieces of it. */ +#ifdef PIC + if (__curbrk == NULL || &__libc_is_static == NULL) +#endif + if (__brk (0) < 0) + return (void *) -1; if (increment == 0) return __curbrk; |