File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,8 +110,7 @@ pub fn exec(mut bytes: Vec<u8>) -> io::Result<()> {
110110 use uucore:: io:: RawWriter ;
111111 use uucore:: pipes:: { pipe, splice, tee} ;
112112
113- const PAGE_SIZE : usize = 4096 ;
114- let aligned = PAGE_SIZE . is_multiple_of ( bytes. len ( ) ) ;
113+ let safe_partial_send = rustix:: pipe:: PIPE_BUF . is_multiple_of ( bytes. len ( ) ) ;
115114 repeat_content_to_capacity ( & mut bytes) ;
116115 let bytes = bytes. as_slice ( ) ;
117116 let stdout = rustix:: stdio:: stdout ( ) ;
@@ -121,7 +120,7 @@ pub fn exec(mut bytes: Vec<u8>) -> io::Result<()> {
121120 if let Ok ( ( p_read, mut p_write) ) = pipe :: < true > ( MAX_ROOTLESS_PIPE_SIZE )
122121 && p_write. write_all ( bytes) . is_ok ( )
123122 {
124- if aligned && tee ( & p_read, & stdout, MAX_ROOTLESS_PIPE_SIZE ) . is_ok ( ) {
123+ if safe_partial_send && tee ( & p_read, & stdout, MAX_ROOTLESS_PIPE_SIZE ) . is_ok ( ) {
125124 while let Ok ( 1 ..) = tee ( & p_read, & stdout, MAX_ROOTLESS_PIPE_SIZE ) { }
126125 } else if let Ok ( ( broker_read, broker_write) ) = pipe :: < true > ( MAX_ROOTLESS_PIPE_SIZE ) {
127126 // tee() cannot control offset and write to non-pipe
You can’t perform that action at this time.
0 commit comments