diff --git a/library/std/src/sys/fs/unix.rs b/library/std/src/sys/fs/unix.rs index 1045a7b7e2f56..acd2c7f5dfbd1 100644 --- a/library/std/src/sys/fs/unix.rs +++ b/library/std/src/sys/fs/unix.rs @@ -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 @@ -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