diff options
| author | David CARLIER <devnexen@gmail.com> | 2021-07-25 06:02:07 +0100 |
|---|---|---|
| committer | David CARLIER <devnexen@gmail.com> | 2021-07-25 06:02:07 +0100 |
| commit | 5407b42cd87c3f42e46e9ed9cfeb5a8a390d2bc0 (patch) | |
| tree | 752666df80aad219323dc1976453a17c3ee4ffdf | |
| parent | 2b4196e97736ffe75433235bf586989cdb4221c4 (diff) | |
| download | rust-5407b42cd87c3f42e46e9ed9cfeb5a8a390d2bc0.tar.gz rust-5407b42cd87c3f42e46e9ed9cfeb5a8a390d2bc0.zip | |
macos current_exe using directly libc instead.
| -rw-r--r-- | Cargo.lock | 4 | ||||
| -rw-r--r-- | library/std/Cargo.toml | 2 | ||||
| -rw-r--r-- | library/std/src/sys/unix/os.rs | 7 |
3 files changed, 5 insertions, 8 deletions
diff --git a/Cargo.lock b/Cargo.lock index 553d9d05e57..673e609fa6f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1880,9 +1880,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.93" +version = "0.2.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41" +checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" dependencies = [ "rustc-std-workspace-core", ] diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 415d874c7fa..8494563bcd9 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -16,7 +16,7 @@ cfg-if = { version = "0.1.8", features = ['rustc-dep-of-std'] } panic_unwind = { path = "../panic_unwind", optional = true } panic_abort = { path = "../panic_abort" } core = { path = "../core" } -libc = { version = "0.2.93", default-features = false, features = ['rustc-dep-of-std'] } +libc = { version = "0.2.98", default-features = false, features = ['rustc-dep-of-std'] } compiler_builtins = { version = "0.1.44" } profiler_builtins = { path = "../profiler_builtins", optional = true } unwind = { path = "../unwind" } diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/unix/os.rs index d3c874edf2d..cc0802ed709 100644 --- a/library/std/src/sys/unix/os.rs +++ b/library/std/src/sys/unix/os.rs @@ -350,17 +350,14 @@ pub fn current_exe() -> io::Result<PathBuf> { #[cfg(any(target_os = "macos", target_os = "ios"))] pub fn current_exe() -> io::Result<PathBuf> { - extern "C" { - fn _NSGetExecutablePath(buf: *mut libc::c_char, bufsize: *mut u32) -> libc::c_int; - } unsafe { let mut sz: u32 = 0; - _NSGetExecutablePath(ptr::null_mut(), &mut sz); + libc::_NSGetExecutablePath(ptr::null_mut(), &mut sz); if sz == 0 { return Err(io::Error::last_os_error()); } let mut v: Vec<u8> = Vec::with_capacity(sz as usize); - let err = _NSGetExecutablePath(v.as_mut_ptr() as *mut i8, &mut sz); + let err = libc::_NSGetExecutablePath(v.as_mut_ptr() as *mut i8, &mut sz); if err != 0 { return Err(io::Error::last_os_error()); } |
