Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion library/std/src/sys/fs/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1884,6 +1884,13 @@ pub fn set_perm(p: &CStr, perm: FilePermissions) -> io::Result<()> {
cvt_r(|| unsafe { libc::chmod(p.as_ptr(), perm.mode) }).map(|_| ())
}

#[cfg(target_os = "vxworks")]
pub fn set_perm_nofollow(_p: &CStr, _perm: FilePermissions) -> io::Result<()> {
// VxWorks has no `O_NOFOLLOW`, and its `fchmodat` rejects
// `AT_SYMLINK_NOFOLLOW` with `ENOTSUP`, so a no-follow chmod is unsupported.
Err(crate::io::ErrorKind::Unsupported.into())
}

#[cfg(target_os = "android")]
pub fn set_perm_nofollow(_p: &CStr, _perm: FilePermissions) -> io::Result<()> {
// Currently Android seems to be having inconsistent behavior with fchmodat
Expand All @@ -1896,7 +1903,7 @@ pub fn set_perm_nofollow(_p: &CStr, _perm: FilePermissions) -> io::Result<()> {
Err(crate::io::ErrorKind::Unsupported.into())
}

#[cfg(not(target_os = "android"))]
#[cfg(not(any(target_os = "android", target_os = "vxworks")))]
pub fn set_perm_nofollow(p: &CStr, perm: FilePermissions) -> io::Result<()> {
#[inline]
/// Helper function for fallback open with `O_NOFOLLOW` + `fchmod` behavior
Expand Down
Loading