about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-07-27 19:52:47 +0900
committerGitHub <noreply@github.com>2021-07-27 19:52:47 +0900
commit988f617f2a78d4449ecb5fef26fa14825fc8ecc8 (patch)
tree2d536e2e4413d90dc63efa8ba45f1e96583a469b /library/std/src/sys
parentd25439481cd442dec4991f5bd0082c8b71004889 (diff)
parent5407b42cd87c3f42e46e9ed9cfeb5a8a390d2bc0 (diff)
downloadrust-988f617f2a78d4449ecb5fef26fa14825fc8ecc8.tar.gz
rust-988f617f2a78d4449ecb5fef26fa14825fc8ecc8.zip
Rollup merge of #87446 - devnexen:macos_update, r=dtolnay
macos current_exe using directly libc instead.
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/unix/os.rs7
1 files changed, 2 insertions, 5 deletions
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());
         }