diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/wc.c | 2 |
2 files changed, 6 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2006-06-26 Jim Meyering <jim@meyering.net> + + Avoid a segfault for wc --files0=- < /dev/null. + * src/wc.c (compute_number_width): Return right away if nfiles == 0. + 2006-06-25 Jim Meyering <jim@meyering.net> * NEWS: wc accepts a new option --files0-from=FILE, where FILE @@ -573,7 +573,7 @@ compute_number_width (int nfiles, struct fstatus const *fstatus) { int width = 1; - if (fstatus[0].failed <= 0) + if (0 < nfiles && fstatus[0].failed <= 0) { int minimum_width = 1; uintmax_t regular_total = 0; |