Skip to content

Commit adc63fa

Browse files
committed
wc: stricter file checking
1 parent 8288be3 commit adc63fa

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/uu/wc/src/wc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ fn try_get_stdin_size() -> Option<usize> {
6161

6262
let file_type = rustix::fs::FileType::from_raw_mode(stat.st_mode);
6363

64-
if file_type == rustix::fs::FileType::RegularFile && stat.st_size > 0 {
64+
if file_type == rustix::fs::FileType::RegularFile && stat.st_size > 0 && stat.st_nlink == 1
65+
{
6566
return Some(stat.st_size as usize);
6667
}
6768

0 commit comments

Comments
 (0)