mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Rollup merge of #94179 - devnexen:getexecname_directcall, r=kennytm
solarish current_exe using libc call directly
This commit is contained in:
commit
21fb81405e
@ -384,11 +384,8 @@ pub fn current_exe() -> io::Result<PathBuf> {
|
|||||||
if let Ok(path) = crate::fs::read_link("/proc/self/path/a.out") {
|
if let Ok(path) = crate::fs::read_link("/proc/self/path/a.out") {
|
||||||
Ok(path)
|
Ok(path)
|
||||||
} else {
|
} else {
|
||||||
extern "C" {
|
|
||||||
fn getexecname() -> *const c_char;
|
|
||||||
}
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let path = getexecname();
|
let path = libc::getexecname();
|
||||||
if path.is_null() {
|
if path.is_null() {
|
||||||
Err(io::Error::last_os_error())
|
Err(io::Error::last_os_error())
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user