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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/uu/tail/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
8 changes: 4 additions & 4 deletions src/uu/tail/src/tail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<File> {
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};
Expand All @@ -237,9 +237,9 @@ fn open_file(path: &Path, use_nonblock_for_fifo: bool) -> io::Result<File> {
.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 {
Expand Down
Loading