diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-10-12 23:03:52 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-10-12 23:03:52 +0400 |
commit | 57cd3486e605b8af16705f322c24dc3d5df8ff03 (patch) | |
tree | d6fb6998a87e2d080fac99a3382a01f88669a65a /winsup/cygwin/dlfcn.cc | |
parent | 697b9afe00c21df9fc74c748ea35113b4b37c4b4 (diff) |
* dlfcn.cc (set_dl_error): Drop useless __stdcall.
(check_path_access): Ditto. Drop FE_CWD from call to find_exec.
(gfpod_helper): Call path_conv::check for all paths containing a dir
separator to more closely follow the Linux search algorithm.
(get_full_path_of_dll): Drop useless __stdcall.
(dlopen): Simplify RTLD_NOLOAD case by calling GetModuleHandleEx
instead of GetModuleHandle/LoadLibrary.
Diffstat (limited to 'winsup/cygwin/dlfcn.cc')
-rw-r--r-- | winsup/cygwin/dlfcn.cc | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/winsup/cygwin/dlfcn.cc b/winsup/cygwin/dlfcn.cc index 6bcdac92d..0868749f8 100644 --- a/winsup/cygwin/dlfcn.cc +++ b/winsup/cygwin/dlfcn.cc @@ -1,7 +1,7 @@ /* dlfcn.cc Copyright 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010, 2011, 2013 Red Hat, Inc. + 2010, 2011, 2013, 2014 Red Hat, Inc. This file is part of Cygwin. @@ -20,7 +20,7 @@ details. */ #include "tls_pbuf.h" #include "ntdll.h" -static void __stdcall +static void set_dl_error (const char *str) { strcpy (_my_tls.locals.dl_buffer, strerror (get_errno ())); @@ -30,10 +30,10 @@ set_dl_error (const char *str) /* Look for an executable file given the name and the environment variable to use for searching (eg., PATH); returns the full pathname (static buffer) if found or NULL if not. */ -inline const char * __stdcall +inline const char * check_path_access (const char *mywinenv, const char *name, path_conv& buf) { - return find_exec (name, buf, mywinenv, FE_NNF | FE_NATIVE | FE_CWD | FE_DLL); + return find_exec (name, buf, mywinenv, FE_NNF | FE_NATIVE | FE_DLL); } /* Search LD_LIBRARY_PATH for dll, if it exists. Search /usr/bin and /usr/lib @@ -41,7 +41,7 @@ check_path_access (const char *mywinenv, const char *name, path_conv& buf) static inline bool gfpod_helper (const char *name, path_conv &real_filename) { - if (isabspath (name)) + if (strpbrk (name, "/\\")) real_filename.check (name, PC_SYM_FOLLOW | PC_NULLEMPTY); else if (!check_path_access ("LD_LIBRARY_PATH=", name, real_filename)) check_path_access ("/usr/bin:/usr/lib", name, real_filename); @@ -50,7 +50,7 @@ gfpod_helper (const char *name, path_conv &real_filename) return !real_filename.error; } -static bool __stdcall +static bool get_full_path_of_dll (const char* str, path_conv &real_filename) { int len = strlen (str); @@ -153,14 +153,13 @@ dlopen (const char *name, int flags) tmp_malloc = __cygwin_user_data.cxx_malloc; #endif - if (!(flags & RTLD_NOLOAD) - || (ret = GetModuleHandleW (path)) != NULL) - { - ret = (void *) LoadLibraryW (path); - if (ret && (flags & RTLD_NODELETE)) - GetModuleHandleExW (GET_MODULE_HANDLE_EX_FLAG_PIN, path, - (HMODULE *) &ret); - } + if (flags & RTLD_NOLOAD) + GetModuleHandleExW (0, path, (HMODULE *) &ret); + else + ret = (void *) LoadLibraryW (path); + if (ret && (flags & RTLD_NODELETE)) + GetModuleHandleExW (GET_MODULE_HANDLE_EX_FLAG_PIN, path, + (HMODULE *) &ret); #ifndef __x86_64__ /* Restore original cxx_malloc pointer. */ |