File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -117,9 +117,18 @@ pub fn set_permissions(path: &Path, perm: FilePermissions) -> io::Result<()> {
117
117
#[ cfg( unix) ]
118
118
pub fn set_permissions_nofollow ( path : & Path , perm : crate :: fs:: Permissions ) -> io:: Result < ( ) > {
119
119
use crate :: fs:: OpenOptions ;
120
- use crate :: os:: unix:: fs:: OpenOptionsExt ;
121
120
122
- OpenOptions :: new ( ) . custom_flags ( libc:: O_NOFOLLOW ) . open ( path) ?. set_permissions ( perm)
121
+ let mut options = OpenOptions :: new ( ) ;
122
+
123
+ // ESP-IDF and Horizon do not support O_NOFOLLOW, so we skip setting it.
124
+ // Their filesystems do not have symbolic links, so no special handling is required.
125
+ #[ cfg( not( any( target_os = "espidf" , target_os = "horizon" ) ) ) ]
126
+ {
127
+ use crate :: os:: unix:: fs:: OpenOptionsExt ;
128
+ options. custom_flags ( libc:: O_NOFOLLOW ) ;
129
+ }
130
+
131
+ options. open ( path) ?. set_permissions ( perm)
123
132
}
124
133
125
134
#[ cfg( not( unix) ) ]
You can’t perform that action at this time.
0 commit comments