summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-05-09 23:32:02 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-05-09 23:32:24 -0700
commit2c436decf8bc57a9173c940a26c80358d499e1b6 (patch)
treef4d4c4553dee0b824581043286b230f9acd970a2
parenta6f94fcebc1645b401eedacbffb5e2ebdedf0f95 (diff)
downloadcoreutils-2c436decf8bc57a9173c940a26c80358d499e1b6.tar.xz
stat: don't report negative file size as huge positive number
* src/stat.c (print_stat): Use out_int, not out_uint for stat.st_size. * NEWS (Bug fixes): Mention it.
-rw-r--r--NEWS3
-rw-r--r--src/stat.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index eb954047b..7ef2f5476 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,9 @@ GNU coreutils NEWS -*- outline -*-
split --number=C /dev/null no longer appears to infloop on GNU/Hurd
[bug introduced in coreutils-8.8]
+ stat no longer reports a negative file size as a huge positive number.
+ [bug present since 'stat' was introduced in fileutils-4.1.9]
+
** New features
fmt now accepts the --goal=WIDTH (-g) option.
diff --git a/src/stat.c b/src/stat.c
index b2e103084..d001cdaa2 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -954,7 +954,7 @@ print_stat (char *pformat, size_t prefix_len, unsigned int m,
out_uint_x (pformat, prefix_len, minor (statbuf->st_rdev));
break;
case 's':
- out_uint (pformat, prefix_len, statbuf->st_size);
+ out_int (pformat, prefix_len, statbuf->st_size);
break;
case 'B':
out_uint (pformat, prefix_len, ST_NBLOCKSIZE);