From 7d301b4b12fa530046d50833739ff81b7a35505a Mon Sep 17 00:00:00 2001 From: Daniele Rapetti <5535617+Iximiel@users.noreply.github.com> Date: Tue, 5 Dec 2023 12:00:25 +0100 Subject: [PATCH] dladdr return now clearer --- src/tools/DLLoader.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tools/DLLoader.cpp b/src/tools/DLLoader.cpp index fad10b2580..e7139383fb 100644 --- a/src/tools/DLLoader.cpp +++ b/src/tools/DLLoader.cpp @@ -84,7 +84,8 @@ DLLoader::EnsureGlobalDLOpen::EnsureGlobalDLOpen(const void *symbol) noexcept { // If the address specified in addr could not be matched to a shared // object, then these functions return 0. In this case, an error // message is not available via dlerror(3). - if(dladdr(symbol, &info)!=0) { + int zeroIsError=dladdr(symbol, &info); + if(zeroIsError!=0) { //This "promotes" to GLOBAL the object with the symbol pointed by ptr handle_ = dlopen(info.dli_fname, RTLD_GLOBAL | RTLD_NOW); } else { @@ -92,7 +93,7 @@ DLLoader::EnsureGlobalDLOpen::EnsureGlobalDLOpen(const void *symbol) noexcept { "+++WARNING+++" "Failure in finding any object that contains the symbol %p.\n", symbol); - + } #else std::fprintf(stderr,