diff options
author | Ian Wienand <ianw@vmware.com> | 2012-02-28 03:10:31 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2012-02-28 03:10:31 +0100 |
commit | 694738f4eb26e8c46e72be7f9c0be64b3a785161 (patch) | |
tree | 1555b74756eb6f15e264dc298f65b740252db43b /coreutils/du.c | |
parent | fc4ebd0d0b189813fa7f8866b0ef590f1ef44f74 (diff) | |
download | busybox-w32-694738f4eb26e8c46e72be7f9c0be64b3a785161.tar.gz busybox-w32-694738f4eb26e8c46e72be7f9c0be64b3a785161.tar.bz2 busybox-w32-694738f4eb26e8c46e72be7f9c0be64b3a785161.zip |
du: use long long for size field
du has issues with files reporting large block counts on
32-bit systems with 4 byte longs. From looking at the stat.c code, it
seems the preference is to use 'long long', rather than blkcnt_t.
function old new delta
du 420 444 +24
du_main 317 321 +4
print 43 41 -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 28/-2) Total: 26 bytes
Signed-off-by: Ian Wienand <ianw@vmware.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/du.c')
-rw-r--r-- | coreutils/du.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/coreutils/du.c b/coreutils/du.c index 34a549f02..09a908c69 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -91,7 +91,7 @@ struct globals { | |||
91 | #define INIT_G() do { } while (0) | 91 | #define INIT_G() do { } while (0) |
92 | 92 | ||
93 | 93 | ||
94 | static void print(unsigned long size, const char *filename) | 94 | static void print(unsigned long long size, const char *filename) |
95 | { | 95 | { |
96 | /* TODO - May not want to defer error checking here. */ | 96 | /* TODO - May not want to defer error checking here. */ |
97 | #if ENABLE_FEATURE_HUMAN_READABLE | 97 | #if ENABLE_FEATURE_HUMAN_READABLE |
@@ -105,15 +105,15 @@ static void print(unsigned long size, const char *filename) | |||
105 | size++; | 105 | size++; |
106 | size >>= 1; | 106 | size >>= 1; |
107 | } | 107 | } |
108 | printf("%lu\t%s\n", size, filename); | 108 | printf("%llu\t%s\n", size, filename); |
109 | #endif | 109 | #endif |
110 | } | 110 | } |
111 | 111 | ||
112 | /* tiny recursive du */ | 112 | /* tiny recursive du */ |
113 | static unsigned long du(const char *filename) | 113 | static unsigned long long du(const char *filename) |
114 | { | 114 | { |
115 | struct stat statbuf; | 115 | struct stat statbuf; |
116 | unsigned long sum; | 116 | unsigned long long sum; |
117 | 117 | ||
118 | if (lstat(filename, &statbuf) != 0) { | 118 | if (lstat(filename, &statbuf) != 0) { |
119 | bb_simple_perror_msg(filename); | 119 | bb_simple_perror_msg(filename); |
@@ -190,7 +190,7 @@ static unsigned long du(const char *filename) | |||
190 | int du_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 190 | int du_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
191 | int du_main(int argc UNUSED_PARAM, char **argv) | 191 | int du_main(int argc UNUSED_PARAM, char **argv) |
192 | { | 192 | { |
193 | unsigned long total; | 193 | unsigned long long total; |
194 | int slink_depth_save; | 194 | int slink_depth_save; |
195 | unsigned opt; | 195 | unsigned opt; |
196 | 196 | ||