diff --git a/cap-primitives/Cargo.toml b/cap-primitives/Cargo.toml index 7e0bc9eb..5e387d2a 100644 --- a/cap-primitives/Cargo.toml +++ b/cap-primitives/Cargo.toml @@ -25,7 +25,7 @@ io-lifetimes = { version = "2.0.0", default-features = false } cap-tempfile = { path = "../cap-tempfile" } [target.'cfg(not(windows))'.dependencies] -rustix = { version = "0.38.0", features = ["fs", "process", "procfs", "termios", "time"] } +rustix = { version = "0.38.32", features = ["fs", "process", "procfs", "termios", "time"] } [target.'cfg(windows)'.dependencies] winx = "0.36.0" diff --git a/cap-primitives/src/rustix/fs/metadata_ext.rs b/cap-primitives/src/rustix/fs/metadata_ext.rs index 0cd9de03..88b2548c 100644 --- a/cap-primitives/src/rustix/fs/metadata_ext.rs +++ b/cap-primitives/src/rustix/fs/metadata_ext.rs @@ -102,6 +102,8 @@ impl ImplMetadataExt { #[inline] #[allow(unused_comparisons)] // NB: rust-lang/rust#115823 requires this here instead of on `st_dev` processing below pub(crate) fn from_rustix(stat: Stat) -> Metadata { + use rustix::fs::StatExt; + Metadata { file_type: ImplFileTypeExt::from_raw_mode(stat.st_mode as RawMode), len: u64::try_from(stat.st_size).unwrap(), @@ -112,12 +114,12 @@ impl ImplMetadataExt { #[cfg(not(any(target_os = "netbsd", target_os = "wasi")))] modified: system_time_from_rustix( - stat.st_mtime.try_into().unwrap(), + stat.mtime().try_into().unwrap(), stat.st_mtime_nsec as _, ), #[cfg(not(any(target_os = "netbsd", target_os = "wasi")))] accessed: system_time_from_rustix( - stat.st_atime.try_into().unwrap(), + stat.atime().try_into().unwrap(), stat.st_atime_nsec as _, ), @@ -191,19 +193,19 @@ impl ImplMetadataExt { rdev: u64::try_from(stat.st_rdev).unwrap(), size: u64::try_from(stat.st_size).unwrap(), #[cfg(not(target_os = "wasi"))] - atime: i64::try_from(stat.st_atime).unwrap(), + atime: i64::try_from(stat.atime()).unwrap(), #[cfg(not(any(target_os = "netbsd", target_os = "wasi")))] atime_nsec: stat.st_atime_nsec as _, #[cfg(target_os = "netbsd")] atime_nsec: stat.st_atimensec as _, #[cfg(not(target_os = "wasi"))] - mtime: i64::try_from(stat.st_mtime).unwrap(), + mtime: i64::try_from(stat.mtime()).unwrap(), #[cfg(not(any(target_os = "netbsd", target_os = "wasi")))] mtime_nsec: stat.st_mtime_nsec as _, #[cfg(target_os = "netbsd")] mtime_nsec: stat.st_mtimensec as _, #[cfg(not(target_os = "wasi"))] - ctime: i64::try_from(stat.st_ctime).unwrap(), + ctime: i64::try_from(stat.ctime()).unwrap(), #[cfg(not(any(target_os = "netbsd", target_os = "wasi")))] ctime_nsec: stat.st_ctime_nsec as _, #[cfg(target_os = "netbsd")]