diff options
| author | ivmarkov <ivan.markov@gmail.com> | 2025-08-22 08:02:00 +0000 |
|---|---|---|
| committer | ivmarkov <ivan.markov@gmail.com> | 2025-08-23 12:32:35 +0000 |
| commit | 6e5a4275f7dca9ba13b4234b3fe821816753d924 (patch) | |
| tree | eba601d6cecde89108c36025a88cca1f8d8dc6a3 | |
| parent | d127901d940d96209fd2ae8ff6769ad2788099fb (diff) | |
| download | rust-6e5a4275f7dca9ba13b4234b3fe821816753d924.tar.gz rust-6e5a4275f7dca9ba13b4234b3fe821816753d924.zip | |
Fix STD build failing for target_os = espidf
| -rw-r--r-- | library/std/src/sys/fs/mod.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/library/std/src/sys/fs/mod.rs b/library/std/src/sys/fs/mod.rs index dbd782f5018..0276bf6e64c 100644 --- a/library/std/src/sys/fs/mod.rs +++ b/library/std/src/sys/fs/mod.rs @@ -117,9 +117,18 @@ pub fn set_permissions(path: &Path, perm: FilePermissions) -> io::Result<()> { #[cfg(unix)] pub fn set_permissions_nofollow(path: &Path, perm: crate::fs::Permissions) -> io::Result<()> { use crate::fs::OpenOptions; - use crate::os::unix::fs::OpenOptionsExt; - OpenOptions::new().custom_flags(libc::O_NOFOLLOW).open(path)?.set_permissions(perm) + let mut options = OpenOptions::new(); + + // ESP-IDF and Horizon do not support O_NOFOLLOW, so we skip setting it. + // Their filesystems do not have symbolic links, so no special handling is required. + #[cfg(not(any(target_os = "espidf", target_os = "horizon")))] + { + use crate::os::unix::fs::OpenOptionsExt; + options.custom_flags(libc::O_NOFOLLOW); + } + + options.open(path)?.set_permissions(perm) } #[cfg(not(unix))] |
