Skip to content
Merged
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
5 changes: 2 additions & 3 deletions src/uu/wc/src/count_fast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ fn count_bytes_using_splice(fd: &impl AsFd) -> Result<usize, usize> {
Err(_) => return Err(byte_count),
}
}
} else if let Ok((pipe_rd, pipe_wr)) = pipe() {
} else {
// input is not pipe. needs broker to use splice() with additional cost
let (pipe_rd, pipe_wr) = pipe().map_err(|_| 0_usize)?;
loop {
match splice(fd, &pipe_wr, MAX_ROOTLESS_PIPE_SIZE) {
Ok(0) => return Ok(byte_count),
Expand All @@ -65,8 +66,6 @@ fn count_bytes_using_splice(fd: &impl AsFd) -> Result<usize, usize> {
Err(_) => return Err(byte_count),
}
}
} else {
Err(0)
}
}

Expand Down
Loading