From f810314bc6ad252430c29636c8ba00acfa81a737 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 20 Feb 2022 08:53:18 +0000 Subject: [PATCH] solarish current_exe using libc call directly --- library/std/src/sys/unix/os.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/unix/os.rs index b268ef5c36400..0b6cdb923bd6a 100644 --- a/library/std/src/sys/unix/os.rs +++ b/library/std/src/sys/unix/os.rs @@ -384,11 +384,8 @@ pub fn current_exe() -> io::Result { 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 {