From: Paul Eggert Date: Thu, 10 May 2012 06:32:02 +0000 (-0700) Subject: stat: don't report negative file size as huge positive number X-Git-Tag: v8.17~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c436decf8bc57a9173c940a26c80358d499e1b6;p=thirdparty%2Fcoreutils.git 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. --- diff --git a/NEWS b/NEWS index eb954047b1..7ef2f54763 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 b2e103084d..d001cdaa21 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);