mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 20:40:05 +00:00
630da022cb
Applying this commit results in bit-identical libc.so.6. The elf/ld-linux-x86-64.so.2 does change, but only in .note.gnu.build-id Reviewed-by: Carlos O'Donell <carlos@redhat.com>
43 lines
895 B
C
43 lines
895 B
C
#include <stdio.h>
|
|
#include <dlfcn.h>
|
|
#include <mcheck.h>
|
|
#include <stdlib.h>
|
|
|
|
static int
|
|
do_test (void)
|
|
{
|
|
void *h;
|
|
int ret = 0;
|
|
/* Carry out *one* failing call to dlopen before starting mtrace to
|
|
force any one-time initialization that may happen to the
|
|
executable link map e.g. expansion and caching of $ORIGIN. */
|
|
h = dlopen ("$ORIGIN/tst-leaks1.o", RTLD_LAZY);
|
|
if (h != NULL)
|
|
{
|
|
puts ("dlopen unexpectedly succeeded");
|
|
ret = 1;
|
|
dlclose (h);
|
|
}
|
|
|
|
/* Start tracing and run each test 5 times to see if there are any
|
|
leaks in the failing dlopen. */
|
|
mtrace ();
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
{
|
|
h = dlopen (i < 5
|
|
? "./tst-leaks1.c"
|
|
: "$ORIGIN/tst-leaks1.o", RTLD_LAZY);
|
|
if (h != NULL)
|
|
{
|
|
puts ("dlopen unexpectedly succeeded");
|
|
ret = 1;
|
|
dlclose (h);
|
|
}
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
#include <support/test-driver.c>
|