Skip to content

Commit

Permalink
Rollup merge of rust-lang#94179 - devnexen:getexecname_directcall, r=…
Browse files Browse the repository at this point in the history
…kennytm

solarish current_exe using libc call directly
  • Loading branch information
matthiaskrgr authored Feb 22, 2022
2 parents caeb466 + f810314 commit ab03d4a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions library/std/src/sys/unix/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ab03d4a

Please sign in to comment.