mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 06:30:37 +00:00
Make dlopen_dll return an error immediately if the library exists but
dlopen() fails.
This commit is contained in:
parent
c2c8bf1bdd
commit
bc23ae6df3
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user