Commit bc23ae6d authored by Alexandre Julliard's avatar Alexandre Julliard

Make dlopen_dll return an error immediately if the library exists but

dlopen() fails.
parent c2c8bf1b
......@@ -103,6 +103,13 @@ static void build_dll_path(void)
}
}
/* check if a given file can be opened */
inline static int file_exists( const char *name )
{
int fd = open( name, O_RDONLY );
if (fd != -1) close( fd );
return (fd != -1);
}
/* open a library for a given dll, searching in the dll path
* 'name' must be the Windows dll name (e.g. "kernel32.dll") */
......@@ -128,6 +135,11 @@ static void *dlopen_dll( const char *name, char *error, int errorsize )
p = buffer + dll_path_maxlen - len;
memcpy( p, dll_paths[i], len );
if ((ret = wine_dlopen( p, RTLD_NOW, error, errorsize ))) break;
if (file_exists( p )) /* exists but cannot be loaded, return the error */
{
free( buffer );
return NULL;
}
}
/* now try the default dlopen search path */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment