diff --git a/src/uucore/src/lib/features/fs.rs b/src/uucore/src/lib/features/fs.rs index 590d0076f..0f2b37dc1 100644 --- a/src/uucore/src/lib/features/fs.rs +++ b/src/uucore/src/lib/features/fs.rs @@ -43,7 +43,7 @@ macro_rules! has { /// Information to uniquely identify a file pub struct FileInformation( - #[cfg(unix)] nix::sys::stat::FileStat, + #[cfg(unix)] rustix::fs::Stat, #[cfg(windows)] winapi_util::file::Information, // WASI does not have nix::sys::stat, so we store std::fs::Metadata instead. #[cfg(target_os = "wasi")] fs::Metadata, @@ -53,7 +53,7 @@ impl FileInformation { /// Get information from a currently open file #[cfg(unix)] pub fn from_file(file: &impl AsFd) -> IOResult { - let stat = nix::sys::stat::fstat(file)?; + let stat = rustix::fs::fstat(file)?; Ok(Self(stat)) } @@ -72,9 +72,9 @@ impl FileInformation { #[cfg(unix)] { let stat = if dereference { - nix::sys::stat::stat(path.as_ref()) + rustix::fs::stat(path.as_ref()) } else { - nix::sys::stat::lstat(path.as_ref()) + rustix::fs::lstat(path.as_ref()) }; Ok(Self(stat?)) } @@ -798,8 +798,7 @@ pub fn is_stdin_directory(stdin: &Stdin) -> bool { #[cfg(unix)] { use mode::{S_IFDIR, S_IFMT}; - use nix::sys::stat::fstat; - let mode = fstat(stdin.as_fd()).unwrap().st_mode as u32; + let mode = rustix::fs::fstat(stdin.as_fd()).unwrap().st_mode as u32; // We use the S_IFMT mask ala S_ISDIR() to avoid mistaking // sockets for directories. mode & S_IFMT == S_IFDIR diff --git a/src/uucore/src/lib/features/mode.rs b/src/uucore/src/lib/features/mode.rs index 6a96307b2..b9694fead 100644 --- a/src/uucore/src/lib/features/mode.rs +++ b/src/uucore/src/lib/features/mode.rs @@ -178,7 +178,8 @@ pub fn get_umask() -> u32 { // from /proc/self/status. But that's a lot of work. #[cfg(unix)] { - use nix::sys::stat::{Mode, umask}; + use rustix::fs::Mode; + use rustix::process::umask; let mask = umask(Mode::empty()); let _ = umask(mask);