dladdr cannot leave dli_fname to be null
This commit is contained in:
@@ -82,9 +82,7 @@ fn current_dll_path() -> Result<PathBuf, String> {
|
||||
let fname_ptr = info.dli_fname.as_ptr();
|
||||
#[cfg(not(target_os = "cygwin"))]
|
||||
let fname_ptr = {
|
||||
if info.dli_fname.is_null() {
|
||||
return Err("dladdr returned null pointer".into());
|
||||
}
|
||||
assert!(!info.dli_fname.is_null(), "the docs do not allow dladdr to be null");
|
||||
info.dli_fname
|
||||
};
|
||||
let bytes = CStr::from_ptr(fname_ptr).to_bytes();
|
||||
|
||||
Reference in New Issue
Block a user