Skip to content

Commit c3d5b9e

Browse files
author
B I Mohammed Abbas
committed
Add lchown unsupported implementation for vxworks
1 parent 792b498 commit c3d5b9e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

library/std/src/os/unix/fs.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,6 @@ pub fn fchown<F: AsFd>(fd: F, uid: Option<u32>, gid: Option<u32>) -> io::Result<
10401040
/// }
10411041
/// ```
10421042
#[stable(feature = "unix_chown", since = "1.73.0")]
1043-
#[cfg(not(any(target_os = "vxworks")))]
10441043
pub fn lchown<P: AsRef<Path>>(dir: P, uid: Option<u32>, gid: Option<u32>) -> io::Result<()> {
10451044
sys::fs::lchown(dir.as_ref(), uid.unwrap_or(u32::MAX), gid.unwrap_or(u32::MAX))
10461045
}

library/std/src/sys/pal/unix/fs.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ impl File {
13371337
// Redox doesn't appear to support `UTIME_OMIT`.
13381338
// ESP-IDF and HorizonOS do not support `futimens` at all and the behavior for those OS is therefore
13391339
// the same as for Redox.
1340-
// `futimens` and `UTIME_OMIT` are a work in progress for vxworks.
1340+
// `futimens` and `UTIME_OMIT` are a work in progress for vxworks.
13411341
let _ = times;
13421342
Err(io::const_io_error!(
13431343
io::ErrorKind::Unsupported,
@@ -1969,14 +1969,20 @@ pub fn fchown(fd: c_int, uid: u32, gid: u32) -> io::Result<()> {
19691969
Ok(())
19701970
}
19711971

1972-
#[cfg(not(any(target_os = "vxworks")))]
1972+
#[cfg(not(target_os = "vxworks"))]
19731973
pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> {
19741974
run_path_with_cstr(path, &|path| {
19751975
cvt(unsafe { libc::lchown(path.as_ptr(), uid as libc::uid_t, gid as libc::gid_t) })
19761976
.map(|_| ())
19771977
})
19781978
}
19791979

1980+
#[cfg(target_os = "vxworks")]
1981+
pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> {
1982+
let (_, _, _) = (path, uid, gid);
1983+
Err(io::const_io_error!(io::ErrorKind::Unsupported, "lchown not supported by vxworks",))
1984+
}
1985+
19801986
#[cfg(not(any(target_os = "fuchsia", target_os = "vxworks")))]
19811987
pub fn chroot(dir: &Path) -> io::Result<()> {
19821988
run_path_with_cstr(dir, &|dir| cvt(unsafe { libc::chroot(dir.as_ptr()) }).map(|_| ()))

0 commit comments

Comments
 (0)