2
0
mirror of git://sourceware.org/git/glibc.git synced 2024-12-09 04:11:27 +08:00
glibc/dlfcn/moddummy2.c
Carlos O'Donell ccdb048df4 Fix recursive dlopen.
The ability to recursively call dlopen is useful for malloc
implementations that wish to load other dynamic modules that
implement reentrant/AS-safe functions to use in their own
implementation.

Given that a user malloc implementation may be called by an
ongoing dlopen to allocate memory the user malloc
implementation interrupts dlopen and if it calls dlopen again
that's a reentrant call.

This patch fixes the issues with the ld.so.cache mapping
and the _r_debug assertion which prevent this from working
as expected.

See:
https://sourceware.org/ml/libc-alpha/2014-12/msg00446.html
2015-01-21 01:51:10 -05:00

14 lines
314 B
C

/* Provide a dummy DSO for tst-rec-dlopen to use. */
#include <stdio.h>
#include <stdlib.h>
int
dummy2 (void)
{
printf ("Called dummy2()\n");
/* If the outer dlopen is not dummy1 (becuase of some error)
then tst-rec-dlopen will see a value of -1 as the returned
result and fail. */
return -1;
}