diff options
| author | bors <bors@rust-lang.org> | 2025-08-28 03:06:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-08-28 03:06:52 +0000 |
| commit | 43a216604a7fc98deb0744513341fc0d09e461d4 (patch) | |
| tree | f6fbed08eb5467fb33e308adb74e4d2843023fdd /library/std/src | |
| parent | d36f964125163c2e698de5559efefb8217b8b7f0 (diff) | |
| parent | 27d6005f7ae41c8da96dc77102e064b0d0a0fde1 (diff) | |
| download | rust-43a216604a7fc98deb0744513341fc0d09e461d4.tar.gz rust-43a216604a7fc98deb0744513341fc0d09e461d4.zip | |
Auto merge of #145949 - jhpratt:rollup-smzd7tr, r=jhpratt
Rollup of 5 pull requests Successful merges: - rust-lang/rust#145382 (Add assembly test for `-Zreg-struct-return` option) - rust-lang/rust#145746 (Fix STD build failing for target_os = "espidf") - rust-lang/rust#145826 (Use AcceptContext in AttribueParser::check_target) - rust-lang/rust#145894 (Ensure the coordinator thread terminates before its channels drop) - rust-lang/rust#145946 (Remove unnecessary `[dependencies.unicode-properties]` entries.) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src')
| -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))] |
