Skip to content

Commit cfa92db

Browse files
oech3cakebaker
authored andcommitted
cat: fallback with pipe() failure
1 parent e170b9a commit cfa92db

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/uu/cat/src/splice.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ pub(super) fn write_fast_using_splice<R: FdReadable, S: AsRawFd + AsFd>(
3434
Err(_) => return Ok(true),
3535
}
3636
}
37-
} else {
37+
} else if let Ok((pipe_rd, pipe_wr)) = pipe() {
3838
// both of in/output are not pipe. needs broker to use splice() with additional costs
39-
let (pipe_rd, pipe_wr) = pipe()?;
4039
loop {
4140
match splice(&handle.reader, &pipe_wr, MAX_ROOTLESS_PIPE_SIZE) {
4241
Ok(0) => return Ok(false),
@@ -54,6 +53,8 @@ pub(super) fn write_fast_using_splice<R: FdReadable, S: AsRawFd + AsFd>(
5453
Err(_) => return Ok(true),
5554
}
5655
}
56+
} else {
57+
Ok(true)
5758
}
5859
}
5960

0 commit comments

Comments
 (0)