mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +00:00
wc: comments
This commit is contained in:
parent
b7f708b233
commit
a97b574fec
1 changed files with 2 additions and 2 deletions
|
@ -128,8 +128,8 @@ pub(crate) fn count_bytes_fast<T: WordCountable>(handle: &mut T) -> (usize, Opti
|
|||
// Since the input stream from file is treated as continuous across both commands inside ().
|
||||
// In cases like this, due to `<` redirect, the `stat.st_mode` would report input as a regular file
|
||||
// and `stat.st_size` would report the size of file on disk
|
||||
// and NOT the remaining number of bytes in the input stream.
|
||||
// However, the raw file descriptor in this situation would be equal to `0`
|
||||
// and NOT the remaining number of bytes in the input stream.
|
||||
// However, the raw file descriptor in this situation would be equal to `0`
|
||||
// for STDIN in both invocations.
|
||||
// Therefore we cannot rely of `st_size` here and should fall back on full read.
|
||||
if fd > 0 && (stat.st_mode as libc::mode_t & S_IFREG) != 0 && stat.st_size > 0 {
|
||||
|
|
Loading…
Reference in a new issue