From c84675241df4e96def8c36527cd1124c0fa73cd3 Mon Sep 17 00:00:00 2001 From: Craig Small Date: Thu, 5 Jan 2012 09:37:58 +1100 Subject: [PATCH] For free -b make the variable a long long Bug-Debian: http://bugs.debian.org/654368 On systems with very large amonut of RAM when they use the -b or --bytes option on free you get overflow and free shows a negative amount of memory, which is obviously wrong. --- free.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/free.c b/free.c index 1aaa5ecb..54825ab0 100644 --- a/free.c +++ b/free.c @@ -106,7 +106,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), "%ld", (long int)(size * 1024)); + snprintf(buf, sizeof(buf), "%lld", (long long int)(size * 1024)); return buf; } if (args.exponent == 2) {