Skip to content

Commit

Permalink
fixup! Try to respect RPATHS of calling dlopen modules with dlinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
pablogsal committed Sep 4, 2024
1 parent ca420a4 commit 15caf46
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/memray/_memray/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 15caf46

Please sign in to comment.