Skip to content

Commit 1e26c6e

Browse files
sylvestreoech3
authored andcommitted
tail: replace nix by rustix
1 parent 62ad74b commit 1e26c6e

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/uu/tail/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ same-file = { workspace = true }
2929
fluent = { workspace = true }
3030

3131
[target.'cfg(unix)'.dependencies]
32-
nix = { workspace = true, features = ["fs"] }
32+
rustix = { workspace = true, features = ["fs"] }
3333

3434
[target.'cfg(windows)'.dependencies]
3535
windows-sys = { workspace = true, features = [

src/uu/tail/src/tail.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ fn tail_file(
220220
/// Without `--pid`, FIFOs block on open() until a writer connects (GNU behavior).
221221
#[cfg(unix)]
222222
fn open_file(path: &Path, use_nonblock_for_fifo: bool) -> io::Result<File> {
223-
use nix::fcntl::{FcntlArg, OFlag, fcntl};
223+
use rustix::fs::{OFlags, fcntl_getfl, fcntl_setfl};
224224
use std::fs::OpenOptions;
225225
use std::os::fd::AsFd;
226226
use std::os::unix::fs::{FileTypeExt, OpenOptionsExt};
@@ -237,9 +237,9 @@ fn open_file(path: &Path, use_nonblock_for_fifo: bool) -> io::Result<File> {
237237
.open(path)?;
238238

239239
// Clear O_NONBLOCK so reads block normally
240-
let flags = fcntl(file.as_fd(), FcntlArg::F_GETFL)?;
241-
let new_flags = OFlag::from_bits_truncate(flags) & !OFlag::O_NONBLOCK;
242-
fcntl(file.as_fd(), FcntlArg::F_SETFL(new_flags))?;
240+
let flags = fcntl_getfl(file.as_fd())?;
241+
let new_flags = flags & !OFlags::NONBLOCK;
242+
fcntl_setfl(file.as_fd(), new_flags)?;
243243

244244
Ok(file)
245245
} else {

0 commit comments

Comments
 (0)