aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-08-22 23:08:37 +0000
committerEric Andersen <andersen@codepoet.org>2003-08-22 23:08:37 +0000
commit97e242658265ed97badfecd3a5d7f596077716d0 (patch)
tree9fd8d2a4b154f2e6b4707480f2a1c4709c5103ff
parent6d3c7e7a9cd5c92e1557f3287ab87658161a8591 (diff)
downloadbusybox-97e242658265ed97badfecd3a5d7f596077716d0.tar.gz
"staywithu" writes:
In BusyBox v1.00-pre2, commands like ls, df with -h option report a wrong file size for files larger than 4GBtye!! For example, when I execute 'ls -l', it reports -rw-r--r-- 1 root root 5368709120 Aug 17 2003 large_stream.tp when I execute 'ls -lh', I expect that -rw-r--r-- 1 root root 5.0G Aug 17 2003 large_stream.tp but it reports -rw-r--r-- 1 root root 1.0G Aug 17 2003 large_stream.tp I fixed this bug that... Line 31 in libbb/human_readable.c and line 275 include/libbb.h const char *make_human_readable_str(unsigned long size => const char *make_human_readable_str(unsigned long long size It's OK!
-rw-r--r--include/libbb.h3
-rw-r--r--libbb/human_readable.c7
2 files changed, 5 insertions, 5 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 750e0bb4f..a6d9a510b 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -267,7 +267,8 @@ enum {
MEGABYTE = (KILOBYTE*1024),
GIGABYTE = (MEGABYTE*1024)
};
-const char *make_human_readable_str(unsigned long size, unsigned long block_size, unsigned long display_unit);
+const char *make_human_readable_str(unsigned long long size,
+ unsigned long block_size, unsigned long display_unit);
int bb_ask_confirmation(void);
int klogctl(int type, char * b, int len);
diff --git a/libbb/human_readable.c b/libbb/human_readable.c
index 7bdad36a9..656889150 100644
--- a/libbb/human_readable.c
+++ b/libbb/human_readable.c
@@ -28,9 +28,8 @@
#include <stdio.h>
#include "libbb.h"
-const char *make_human_readable_str(unsigned long size,
- unsigned long block_size,
- unsigned long display_unit)
+const char *make_human_readable_str(unsigned long long size,
+ unsigned long block_size, unsigned long display_unit)
{
/* The code will adjust for additional (appended) units. */
static const char zero_and_units[] = { '0', 0, 'k', 'M', 'G', 'T' };
@@ -48,7 +47,7 @@ const char *make_human_readable_str(unsigned long size,
f = fmt;
frac = 0;
- val = ((unsigned long long) size) * block_size;
+ val = size * block_size;
if (val == 0) {
return u;
}