]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Avoid a segfault for wc --files0=- < /dev/null.
authorJim Meyering <jim@meyering.net>
Mon, 26 Jun 2006 08:39:59 +0000 (08:39 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 26 Jun 2006 08:39:59 +0000 (08:39 +0000)
* src/wc.c (compute_number_width): Return right away if nfiles == 0.

ChangeLog
src/wc.c

index 66673af2da4741732d9bd32c0de329475903c73f..2efa74a9049563f1d7afd0fc73a8e139fddcb5c7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 29c624015cb0e5005aab9c846e3fedcc749b8f3c..1da5373e35373cf0902b7ca8c01b359a84c287b4 100644 (file)
--- a/src/wc.c
+++ b/src/wc.c
@@ -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;