File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -481,7 +481,7 @@ fn print_fast<R: FdReadable>(handle: &mut InputHandle<R>) -> CatResult<()> {
481481 let mut stdout = stdout;
482482 // Try to use the splice() system call for faster writing. If it works, we're done.
483483 #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
484- if ! uucore:: pipes:: splice_unbounded_auto ( & handle. reader , & mut stdout) ?
484+ if uucore:: pipes:: splice_unbounded_auto ( & handle. reader , & mut stdout) ?. is_ok ( )
485485 && !uucore:: pipes:: might_fuse ( & handle. reader )
486486 {
487487 return Ok ( ( ) ) ;
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ pub fn copy_stream(
2323) -> crate :: error:: UResult < ( ) > {
2424 // If we're on Linux or Android, try to use the splice() system call
2525 // for faster writing. If it works, we're done.
26- if crate :: pipes:: splice_unbounded_auto ( src, dest) ? {
26+ if crate :: pipes:: splice_unbounded_auto ( src, dest) ?. is_err ( ) {
2727 // If the splice() call failed, fall back on writing "without buffering", or order of output would be wrong
2828 // unrelated for cp /dev/stdin since cp does not have multiple input? <https://github.com/uutils/coreutils/issues/5186>
2929 std:: io:: copy ( src, & mut crate :: io:: RawWriter ( dest) ) ?;
Original file line number Diff line number Diff line change @@ -154,13 +154,15 @@ pub fn splice_unbounded_broker(
154154/// (the fallback will be embedded to this function in the future)
155155#[ inline]
156156#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
157- pub fn splice_unbounded_auto ( source : & impl AsFd , dest : & mut impl AsFd ) -> std:: io:: Result < bool > {
158- // use splice to check that input or output is pipe which is efficient
159- let fallback = match splice ( & source, dest, MAX_ROOTLESS_PIPE_SIZE ) {
160- Ok ( _) => splice_unbounded ( source, dest) . is_err ( ) ,
161- _ => splice_unbounded_broker ( source, dest) ?. is_err ( ) ,
162- } ;
163- Ok ( fallback)
157+ pub fn splice_unbounded_auto (
158+ source : & impl AsFd ,
159+ dest : & mut impl AsFd ,
160+ ) -> std:: io:: Result < Result < ( ) , ( ) > > {
161+ if splice_unbounded ( source, dest) . is_err ( ) {
162+ // input or output is not pipe
163+ return splice_unbounded_broker ( source, dest) ;
164+ }
165+ Ok ( Ok ( ( ) ) )
164166}
165167
166168/// splice `n` bytes with safe read/write fallback
You can’t perform that action at this time.
0 commit comments