diff --git a/Cargo.lock b/Cargo.lock index 244332276c7..84b43ce6320 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4246,9 +4246,9 @@ dependencies = [ "fluent", "libc", "memchr", - "nix", "notify", "rstest", + "rustix", "same-file", "uucore", "windows-sys 0.61.2", diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index 5e11a54119c..f67062d6e2b 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -29,7 +29,7 @@ same-file = { workspace = true } fluent = { workspace = true } [target.'cfg(unix)'.dependencies] -nix = { workspace = true, features = ["fs"] } +rustix = { workspace = true, features = ["fs"] } [target.'cfg(windows)'.dependencies] windows-sys = { workspace = true, features = [ diff --git a/src/uu/tail/src/tail.rs b/src/uu/tail/src/tail.rs index 5b0c6d75c36..6bd812a1eb9 100644 --- a/src/uu/tail/src/tail.rs +++ b/src/uu/tail/src/tail.rs @@ -220,7 +220,7 @@ fn tail_file( /// Without `--pid`, FIFOs block on open() until a writer connects (GNU behavior). #[cfg(unix)] fn open_file(path: &Path, use_nonblock_for_fifo: bool) -> io::Result { - use nix::fcntl::{FcntlArg, OFlag, fcntl}; + use rustix::fs::{OFlags, fcntl_getfl, fcntl_setfl}; use std::fs::OpenOptions; use std::os::fd::AsFd; use std::os::unix::fs::{FileTypeExt, OpenOptionsExt}; @@ -237,9 +237,9 @@ fn open_file(path: &Path, use_nonblock_for_fifo: bool) -> io::Result { .open(path)?; // Clear O_NONBLOCK so reads block normally - let flags = fcntl(file.as_fd(), FcntlArg::F_GETFL)?; - let new_flags = OFlag::from_bits_truncate(flags) & !OFlag::O_NONBLOCK; - fcntl(file.as_fd(), FcntlArg::F_SETFL(new_flags))?; + let flags = fcntl_getfl(file.as_fd())?; + let new_flags = flags & !OFlags::NONBLOCK; + fcntl_setfl(file.as_fd(), new_flags)?; Ok(file) } else {