Skip to content

Commit 988f617

Browse files
authored
Rollup merge of #87446 - devnexen:macos_update, r=dtolnay
macos current_exe using directly libc instead.
2 parents d254394 + 5407b42 commit 988f617

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1880,9 +1880,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
18801880

18811881
[[package]]
18821882
name = "libc"
1883-
version = "0.2.93"
1883+
version = "0.2.98"
18841884
source = "registry+https://github.com/rust-lang/crates.io-index"
1885-
checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41"
1885+
checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790"
18861886
dependencies = [
18871887
"rustc-std-workspace-core",
18881888
]

library/std/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cfg-if = { version = "0.1.8", features = ['rustc-dep-of-std'] }
1616
panic_unwind = { path = "../panic_unwind", optional = true }
1717
panic_abort = { path = "../panic_abort" }
1818
core = { path = "../core" }
19-
libc = { version = "0.2.93", default-features = false, features = ['rustc-dep-of-std'] }
19+
libc = { version = "0.2.98", default-features = false, features = ['rustc-dep-of-std'] }
2020
compiler_builtins = { version = "0.1.44" }
2121
profiler_builtins = { path = "../profiler_builtins", optional = true }
2222
unwind = { path = "../unwind" }

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

+2-5
Original file line numberDiff line numberDiff line change
@@ -350,17 +350,14 @@ pub fn current_exe() -> io::Result<PathBuf> {
350350

351351
#[cfg(any(target_os = "macos", target_os = "ios"))]
352352
pub fn current_exe() -> io::Result<PathBuf> {
353-
extern "C" {
354-
fn _NSGetExecutablePath(buf: *mut libc::c_char, bufsize: *mut u32) -> libc::c_int;
355-
}
356353
unsafe {
357354
let mut sz: u32 = 0;
358-
_NSGetExecutablePath(ptr::null_mut(), &mut sz);
355+
libc::_NSGetExecutablePath(ptr::null_mut(), &mut sz);
359356
if sz == 0 {
360357
return Err(io::Error::last_os_error());
361358
}
362359
let mut v: Vec<u8> = Vec::with_capacity(sz as usize);
363-
let err = _NSGetExecutablePath(v.as_mut_ptr() as *mut i8, &mut sz);
360+
let err = libc::_NSGetExecutablePath(v.as_mut_ptr() as *mut i8, &mut sz);
364361
if err != 0 {
365362
return Err(io::Error::last_os_error());
366363
}

0 commit comments

Comments
 (0)