From 60a7cab12ecae8324652093c3b09b930850efbb6 Mon Sep 17 00:00:00 2001 From: Jesse Schalken Date: Thu, 23 Oct 2025 00:03:48 +1100 Subject: [PATCH 1/2] Use fstatat() in DirEntry::metadata on Apple platforms --- library/std/src/sys/fs/unix.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/std/src/sys/fs/unix.rs b/library/std/src/sys/fs/unix.rs index d9a7fcb0e2d39..aa06955b16e0c 100644 --- a/library/std/src/sys/fs/unix.rs +++ b/library/std/src/sys/fs/unix.rs @@ -14,9 +14,10 @@ use libc::c_char; target_os = "fuchsia", target_os = "hurd", target_os = "illumos", + target_vendor = "apple", ))] use libc::dirfd; -#[cfg(any(target_os = "fuchsia", target_os = "illumos"))] +#[cfg(any(target_os = "fuchsia", target_os = "illumos", target_vendor = "apple")] use libc::fstatat as fstatat64; #[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "hurd"))] use libc::fstatat64; @@ -907,6 +908,7 @@ impl DirEntry { target_os = "fuchsia", target_os = "hurd", target_os = "illumos", + target_vendor = "apple", ), not(miri) // no dirfd on Miri ))] @@ -937,6 +939,7 @@ impl DirEntry { target_os = "fuchsia", target_os = "hurd", target_os = "illumos", + target_vendor = "apple", )), miri ))] From fe4c2a202d585c950c4d5812a0202fd8dd5f1df7 Mon Sep 17 00:00:00 2001 From: Jesse Schalken Date: Thu, 23 Oct 2025 00:37:40 +1100 Subject: [PATCH 2/2] typo --- library/std/src/sys/fs/unix.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/sys/fs/unix.rs b/library/std/src/sys/fs/unix.rs index aa06955b16e0c..32dc1a5e89766 100644 --- a/library/std/src/sys/fs/unix.rs +++ b/library/std/src/sys/fs/unix.rs @@ -17,7 +17,7 @@ use libc::c_char; target_vendor = "apple", ))] use libc::dirfd; -#[cfg(any(target_os = "fuchsia", target_os = "illumos", target_vendor = "apple")] +#[cfg(any(target_os = "fuchsia", target_os = "illumos", target_vendor = "apple"))] use libc::fstatat as fstatat64; #[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "hurd"))] use libc::fstatat64;