mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
wc: Do not use st_size if it equals zero
Pseudo-filesystems often cannot compute the size of the file correctly and report 0 for the size. Ignore the size when it's zero and fallback to the size unknown code. PR: 276093 Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/985
This commit is contained in:
parent
5ff76402da
commit
8e05c2373e
1 changed files with 2 additions and 1 deletions
|
|
@ -230,7 +230,8 @@ cnt(const char *file)
|
|||
(void)close(fd);
|
||||
return (1);
|
||||
}
|
||||
if (S_ISREG(sb.st_mode)) {
|
||||
/* pseudo-filesystems advertize a zero size */
|
||||
if (S_ISREG(sb.st_mode) && sb.st_size > 0) {
|
||||
reset_siginfo();
|
||||
charct = sb.st_size;
|
||||
show_cnt(file, linect, wordct, charct, llct);
|
||||
|
|
|
|||
Loading…
Reference in a new issue