From 15caf46e8a523b10ea302a6eb6b69d7dfcce9b4e Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Wed, 4 Sep 2024 16:38:40 +0100 Subject: [PATCH] fixup! Try to respect RPATHS of calling dlopen modules with dlinfo --- src/memray/_memray/hooks.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/memray/_memray/hooks.cpp b/src/memray/_memray/hooks.cpp index 809d51a845..d23fbefd45 100644 --- a/src/memray/_memray/hooks.cpp +++ b/src/memray/_memray/hooks.cpp @@ -352,17 +352,12 @@ dlopen(const char* filename, int flag) noexcept if (dlinfo(caller, RTLD_DI_SERINFO, paths) == 0) { for (unsigned int i = 0; i != paths->dls_cnt; ++i) { const char* name = paths->dls_serpath[i].dls_name; - std::string dir; if (name == nullptr || name[0] == '\0') { - // In the dynamic linking search path, an - // empty entry typically represents the - // current working directory ($PWD). - dir = "./"; - } else { - dir = name; - if (dir.back() != '/') { - dir += '/'; - } + continue; + } + std::string dir = name; + if (dir.back() != '/') { + dir += '/'; } dir += filename;