* 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.
This commit is contained in:
parent
697b9afe00
commit
57cd3486e6
@ -1,3 +1,13 @@
|
|||||||
|
2014-10-12 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2014-10-11 Christian Franke <franke@computer.org>
|
2014-10-11 Christian Franke <franke@computer.org>
|
||||||
|
|
||||||
Add setsockopt(sd, SOL_SOCKET, SO_PEERCRED, NULL, 0) to disable
|
Add setsockopt(sd, SOL_SOCKET, SO_PEERCRED, NULL, 0) to disable
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* dlfcn.cc
|
/* dlfcn.cc
|
||||||
|
|
||||||
Copyright 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
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.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ details. */
|
|||||||
#include "tls_pbuf.h"
|
#include "tls_pbuf.h"
|
||||||
#include "ntdll.h"
|
#include "ntdll.h"
|
||||||
|
|
||||||
static void __stdcall
|
static void
|
||||||
set_dl_error (const char *str)
|
set_dl_error (const char *str)
|
||||||
{
|
{
|
||||||
strcpy (_my_tls.locals.dl_buffer, strerror (get_errno ()));
|
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
|
/* Look for an executable file given the name and the environment
|
||||||
variable to use for searching (eg., PATH); returns the full
|
variable to use for searching (eg., PATH); returns the full
|
||||||
pathname (static buffer) if found or NULL if not. */
|
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)
|
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
|
/* 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
|
static inline bool
|
||||||
gfpod_helper (const char *name, path_conv &real_filename)
|
gfpod_helper (const char *name, path_conv &real_filename)
|
||||||
{
|
{
|
||||||
if (isabspath (name))
|
if (strpbrk (name, "/\\"))
|
||||||
real_filename.check (name, PC_SYM_FOLLOW | PC_NULLEMPTY);
|
real_filename.check (name, PC_SYM_FOLLOW | PC_NULLEMPTY);
|
||||||
else if (!check_path_access ("LD_LIBRARY_PATH=", name, real_filename))
|
else if (!check_path_access ("LD_LIBRARY_PATH=", name, real_filename))
|
||||||
check_path_access ("/usr/bin:/usr/lib", 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;
|
return !real_filename.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool __stdcall
|
static bool
|
||||||
get_full_path_of_dll (const char* str, path_conv &real_filename)
|
get_full_path_of_dll (const char* str, path_conv &real_filename)
|
||||||
{
|
{
|
||||||
int len = strlen (str);
|
int len = strlen (str);
|
||||||
@ -153,14 +153,13 @@ dlopen (const char *name, int flags)
|
|||||||
tmp_malloc = __cygwin_user_data.cxx_malloc;
|
tmp_malloc = __cygwin_user_data.cxx_malloc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!(flags & RTLD_NOLOAD)
|
if (flags & RTLD_NOLOAD)
|
||||||
|| (ret = GetModuleHandleW (path)) != NULL)
|
GetModuleHandleExW (0, path, (HMODULE *) &ret);
|
||||||
{
|
else
|
||||||
ret = (void *) LoadLibraryW (path);
|
ret = (void *) LoadLibraryW (path);
|
||||||
if (ret && (flags & RTLD_NODELETE))
|
if (ret && (flags & RTLD_NODELETE))
|
||||||
GetModuleHandleExW (GET_MODULE_HANDLE_EX_FLAG_PIN, path,
|
GetModuleHandleExW (GET_MODULE_HANDLE_EX_FLAG_PIN, path,
|
||||||
(HMODULE *) &ret);
|
(HMODULE *) &ret);
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef __x86_64__
|
#ifndef __x86_64__
|
||||||
/* Restore original cxx_malloc pointer. */
|
/* Restore original cxx_malloc pointer. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user