File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ fn count_bytes_using_splice(fd: &impl AsFd) -> Result<usize, usize> {
4848 // - sender without splice is bottleneck of our wc -c
4949 loop {
5050 match splice ( fd, & null_file, MAX_ROOTLESS_PIPE_SIZE ) {
51- Ok ( 0 ) => break ,
51+ Ok ( 0 ) => return Ok ( byte_count ) ,
5252 Ok ( res) => byte_count += res,
5353 Err ( _) => return Err ( byte_count) ,
5454 }
@@ -57,7 +57,7 @@ fn count_bytes_using_splice(fd: &impl AsFd) -> Result<usize, usize> {
5757 // input is not pipe. needs broker to use splice() with additional cost
5858 loop {
5959 match splice ( fd, & pipe_wr, MAX_ROOTLESS_PIPE_SIZE ) {
60- Ok ( 0 ) => break ,
60+ Ok ( 0 ) => return Ok ( byte_count ) ,
6161 Ok ( res) => {
6262 byte_count += res;
6363 splice_exact ( & pipe_rd, & null_file, res) . map_err ( |_| byte_count) ?;
@@ -66,10 +66,8 @@ fn count_bytes_using_splice(fd: &impl AsFd) -> Result<usize, usize> {
6666 }
6767 }
6868 } else {
69- return Ok ( 0_usize ) ;
69+ Err ( 0 )
7070 }
71-
72- Ok ( byte_count)
7371}
7472
7573/// In the special case where we only need to count the number of bytes. There
You can’t perform that action at this time.
0 commit comments