Rollup merge of #94179 - devnexen:getexecname_directcall, r=kennytm

solarish current_exe using libc call directly
This commit is contained in:
Matthias Krüger 2022-02-22 12:16:30 +01:00 committed by GitHub
commit 21fb81405e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 4 deletions

View File

@ -384,11 +384,8 @@ pub fn current_exe() -> io::Result<PathBuf> {
if let Ok(path) = crate::fs::read_link("/proc/self/path/a.out") {
Ok(path)
} else {
extern "C" {
fn getexecname() -> *const c_char;
}
unsafe {
let path = getexecname();
let path = libc::getexecname();
if path.is_null() {
Err(io::Error::last_os_error())
} else {