From 0d20fdf7702ad07e2ccf1f1a7d1ee43be126aff1 Mon Sep 17 00:00:00 2001 From: WPMGPRoSToTeMa Date: Tue, 12 Sep 2017 21:26:11 +0300 Subject: [PATCH] Moved fixed flags under REHLDS_FIXES and LAUNCHER_FIXES Removed fixed flags from unnecessary places --- rehlds/dedicated/src/sys_linux.cpp | 4 ++++ rehlds/engine/filesystem_internal.cpp | 2 +- rehlds/engine/sys_dll.cpp | 4 ++++ rehlds/hookers/memory.cpp | 2 +- rehlds/public/interface.cpp | 10 +++++----- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/rehlds/dedicated/src/sys_linux.cpp b/rehlds/dedicated/src/sys_linux.cpp index 0ea8df0..db6976b 100644 --- a/rehlds/dedicated/src/sys_linux.cpp +++ b/rehlds/dedicated/src/sys_linux.cpp @@ -227,7 +227,11 @@ long CSys::LoadLibrary(char *lib) Q_snprintf(absolute_lib, sizeof(absolute_lib), "%s/%s", cwd, lib); +#ifdef LAUNCHER_FIXES void *hDll = dlopen(absolute_lib, RTLD_NOW | RTLD_DEEPBIND | RTLD_LOCAL); +#else // LAUNCHER_FIXES + void *hDll = dlopen(absolute_lib, RTLD_NOW); +#endif // LAUNCHER_FIXES if (!hDll) { ErrorMessage(1, dlerror()); diff --git a/rehlds/engine/filesystem_internal.cpp b/rehlds/engine/filesystem_internal.cpp index 765f0ce..ca100df 100644 --- a/rehlds/engine/filesystem_internal.cpp +++ b/rehlds/engine/filesystem_internal.cpp @@ -330,7 +330,7 @@ void *FS_LoadLibrary(const char *dllName) #ifdef _WIN32 result = LoadLibraryA(dllName); #else - result = dlopen(dllName, RTLD_NOW | RTLD_DEEPBIND | RTLD_LOCAL); + result = dlopen(dllName, RTLD_NOW); #endif } diff --git a/rehlds/engine/sys_dll.cpp b/rehlds/engine/sys_dll.cpp index 167897e..390f9ab 100644 --- a/rehlds/engine/sys_dll.cpp +++ b/rehlds/engine/sys_dll.cpp @@ -1067,7 +1067,11 @@ void LoadThisDll(const char *szDllFilename) goto IgnoreThisDLL; } #else // _WIN32 +#ifdef REHLDS_FIXES void *hDLL = dlopen(szDllFilename, RTLD_NOW | RTLD_DEEPBIND | RTLD_LOCAL); +#else // REHLDS_FIXES + void *hDLL = dlopen(szDllFilename, RTLD_NOW); +#endif // REHLDS_FIXES if (!hDLL) { Con_Printf("LoadLibrary failed on %s: %s\n", szDllFilename, dlerror()); diff --git a/rehlds/hookers/memory.cpp b/rehlds/hookers/memory.cpp index 9819d3f..e0f37d8 100644 --- a/rehlds/hookers/memory.cpp +++ b/rehlds/hookers/memory.cpp @@ -232,7 +232,7 @@ bool HIDDEN FillModule(Section *section, Module *module) module->base = base; module->size = end - base; module->end = module->base + module->size - 1; - module->handle = (size_t)dlopen(filename, RTLD_NOW | RTLD_DEEPBIND | RTLD_LOCAL); // lock from unloading + module->handle = (size_t)dlopen(filename, RTLD_NOW); // lock from unloading ProcessModuleData(module); diff --git a/rehlds/public/interface.cpp b/rehlds/public/interface.cpp index d97b9b6..d5a35ad 100644 --- a/rehlds/public/interface.cpp +++ b/rehlds/public/interface.cpp @@ -88,7 +88,7 @@ void *GetModuleHandle(const char *name) return nullptr; } - if ((handle = dlopen(name, RTLD_NOW | RTLD_DEEPBIND | RTLD_LOCAL)) == nullptr) + if ((handle = dlopen(name, RTLD_NOW)) == nullptr) { //printf("Error:%s\n",dlerror()); // couldn't open this file @@ -139,12 +139,12 @@ CSysModule *Sys_LoadModule(const char *pModuleName) szCwd[strlen(szCwd) - 1] = '\0'; _snprintf(szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s/%s", szCwd, pModuleName); - hDLL = dlopen(szAbsoluteModuleName, RTLD_NOW | RTLD_DEEPBIND | RTLD_LOCAL); + hDLL = dlopen(szAbsoluteModuleName, RTLD_NOW); } else { _snprintf(szAbsoluteModuleName, sizeof(szAbsoluteModuleName), "%s", pModuleName); - hDLL = dlopen(pModuleName, RTLD_NOW | RTLD_DEEPBIND | RTLD_LOCAL); + hDLL = dlopen(pModuleName, RTLD_NOW); } #endif // _WIN32 @@ -158,11 +158,11 @@ CSysModule *Sys_LoadModule(const char *pModuleName) #elif defined(OSX) printf("Error: %s\n", dlerror()); _snprintf(str, sizeof(str), "%s.dylib", szAbsoluteModuleName); - hDLL = dlopen(str, RTLD_NOW | RTLD_DEEPBIND | RTLD_LOCAL); + hDLL = dlopen(str, RTLD_NOW); #else printf("Error: %s\n", dlerror()); _snprintf(str, sizeof(str), "%s.so", szAbsoluteModuleName); - hDLL = dlopen(str, RTLD_NOW | RTLD_DEEPBIND | RTLD_LOCAL); + hDLL = dlopen(str, RTLD_NOW); #endif }