mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
tail: replace nix by rustix
This commit is contained in:
Generated
+1
-1
@@ -4246,9 +4246,9 @@ dependencies = [
|
||||
"fluent",
|
||||
"libc",
|
||||
"memchr",
|
||||
"nix",
|
||||
"notify",
|
||||
"rstest",
|
||||
"rustix",
|
||||
"same-file",
|
||||
"uucore",
|
||||
"windows-sys 0.61.2",
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
@@ -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};
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user