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.
This commit is contained in:
Craig Small 2012-01-05 09:37:58 +11:00
parent 5219a9c453
commit c84675241d

2
free.c
View File

@ -106,7 +106,7 @@ static const char *scale_size(unsigned long size, int flags, struct commandline_
if (!(flags & FREE_HUMANREADABLE)) { if (!(flags & FREE_HUMANREADABLE)) {
if (args.exponent == 1) { if (args.exponent == 1) {
/* in bytes, which can not be in SI */ /* 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; return buf;
} }
if (args.exponent == 2) { if (args.exponent == 2) {