]> granicus.if.org Git - procps-ng/commitdiff
Show sizes > 4G correctly in bytes on 32-bit machines.
authorAdam Sampson <ats@offog.org>
Tue, 26 Jun 2012 13:06:45 +0000 (14:06 +0100)
committerCraig Small <csmall@enc.com.au>
Tue, 26 Jun 2012 20:47:38 +0000 (06:47 +1000)
size is a long; this needs to be a 64-bit multiplication.

free.c

diff --git a/free.c b/free.c
index 849f4e4cfd26dd187a8499c4a87cc616dbbdcf9a..ecaeccdd9b7fc6426e392c19729111dca59f3a04 100644 (file)
--- a/free.c
+++ b/free.c
@@ -121,7 +121,7 @@ static const char *scale_size(unsigned long size, int flags, struct commandline_
        if (!(flags & FREE_HUMANREADABLE)) {
                if (args.exponent == 1) {
                        /* in bytes, which can not be in SI */
-                       snprintf(buf, sizeof(buf), "%lld", (long long int)(size * 1024));
+                       snprintf(buf, sizeof(buf), "%lld", ((long long int)size) * 1024);
                        return buf;
                }
                if (args.exponent == 2) {