Use wine_dlsym instead of dlsym to avoid the glibc dlerror bug.
Call dlsym with RTLD_DEFAULT for symbols that we don't redefine to
work around another glibc bug.
diff --git a/loader/kthread.c b/loader/kthread.c
index 46940ea..cd74d54 100644
--- a/loader/kthread.c
+++ b/loader/kthread.c
@@ -146,7 +146,7 @@
static inline void writejump( const char *symbol, void *dest )
{
#if defined(__GLIBC__) && defined(__i386__)
- unsigned char *addr = dlsym( RTLD_NEXT, symbol );
+ unsigned char *addr = wine_dlsym( RTLD_NEXT, symbol, NULL, 0 );
if (!addr) return;
@@ -562,7 +562,7 @@
if (!libc_fork)
{
- libc_fork = dlsym( RTLD_NEXT, "fork" );
+ libc_fork = wine_dlsym( RTLD_NEXT, "fork", NULL, 0 );
assert( libc_fork );
}
pthread_mutex_lock( &atfork_mutex );
@@ -926,7 +926,7 @@
{
if (!libc_sigaction)
{
- libc_sigaction = dlsym( RTLD_NEXT, "sigaction" );
+ libc_sigaction = wine_dlsym( RTLD_NEXT, "sigaction", NULL, 0 );
assert( libc_sigaction );
}
return libc_sigaction(signum, act, oldact);
@@ -939,10 +939,10 @@
if (!done)
{
done = 1;
- libc_fork = dlsym( RTLD_NEXT, "fork" );
- libc_sigaction = dlsym( RTLD_NEXT, "sigaction" );
- libc_uselocale = dlsym( RTLD_NEXT, "uselocale" );
- libc_pthread_init = dlsym( RTLD_NEXT, "__libc_pthread_init" );
+ libc_fork = wine_dlsym( RTLD_NEXT, "fork", NULL, 0 );
+ libc_sigaction = wine_dlsym( RTLD_NEXT, "sigaction", NULL, 0 );
+ libc_uselocale = wine_dlsym( RTLD_DEFAULT, "uselocale", NULL, 0 );
+ libc_pthread_init = wine_dlsym( RTLD_NEXT, "__libc_pthread_init", NULL, 0 );
if (libc_pthread_init) libc_multiple_threads = libc_pthread_init( &libc_pthread_functions );
}
}