Skip to content

Commit 21fb814

Browse files
authored
Rollup merge of #94179 - devnexen:getexecname_directcall, r=kennytm
solarish current_exe using libc call directly
2 parents a53b604 + f810314 commit 21fb814

File tree

1 file changed

+1
-4
lines changed
  • library/std/src/sys/unix

1 file changed

+1
-4
lines changed

library/std/src/sys/unix/os.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,8 @@ pub fn current_exe() -> io::Result<PathBuf> {
384384
if let Ok(path) = crate::fs::read_link("/proc/self/path/a.out") {
385385
Ok(path)
386386
} else {
387-
extern "C" {
388-
fn getexecname() -> *const c_char;
389-
}
390387
unsafe {
391-
let path = getexecname();
388+
let path = libc::getexecname();
392389
if path.is_null() {
393390
Err(io::Error::last_os_error())
394391
} else {

0 commit comments

Comments
 (0)