Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 5 additions & 6 deletions src/uucore/src/lib/features/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -53,7 +53,7 @@ impl FileInformation {
/// Get information from a currently open file
#[cfg(unix)]
pub fn from_file(file: &impl AsFd) -> IOResult<Self> {
let stat = nix::sys::stat::fstat(file)?;
let stat = rustix::fs::fstat(file)?;
Ok(Self(stat))
}

Expand All @@ -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?))
}
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/uucore/src/lib/features/mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading