Skip to content

Commit

Permalink
Handle dladdr's failure
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Jerphanion <[email protected]>
  • Loading branch information
jjerphan committed Jan 29, 2025
1 parent fd9561b commit 9ab42d9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libmamba/src/core/util_os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,14 @@ namespace mamba
#else
fs::u8path libmamba_path;
Dl_info dl_info;
if (dladdr(reinterpret_cast<void*>(get_libmamba_path), &dl_info))
if (!dladdr(reinterpret_cast<void*>(get_libmamba_path), &dl_info))
{
libmamba_path = dl_info.dli_fname;
throw mamba_error(
"Could not find libmamba's path. (dladdr failed)",
mamba_error_code::internal_failure
);
}
libmamba_path = dl_info.dli_fname;
return libmamba_path;
#endif
}
Expand Down

0 comments on commit 9ab42d9

Please sign in to comment.