summaryrefslogtreecommitdiff
path: root/coreutils/du.c
diff options
context:
space:
mode:
authorGlenn L McGrath2004-03-10 09:58:51 +0000
committerGlenn L McGrath2004-03-10 09:58:51 +0000
commitc66ebe4200af584b9101bcadc4a11509db8318a1 (patch)
tree8fe66fd701ef921e9f2411c42645288d48585fa6 /coreutils/du.c
parent44c0e17dbe06e551f73141f56d75aa79129f1aea (diff)
downloadbusybox-c66ebe4200af584b9101bcadc4a11509db8318a1.zip
busybox-c66ebe4200af584b9101bcadc4a11509db8318a1.tar.gz
When displaying the size in 1kB blocks round up if an odd number of
blocks
Diffstat (limited to 'coreutils/du.c')
-rw-r--r--coreutils/du.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/coreutils/du.c b/coreutils/du.c
index 7984d65..df75a69 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -77,7 +77,11 @@ static void print(long size, char *filename)
bb_printf("%s\t%s\n", make_human_readable_str(size, 512, disp_hr),
filename);
#else
- bb_printf("%ld\t%s\n", size >> disp_k, filename);
+ if (disp_k) {
+ size++;
+ size >>= 1;
+ }
+ bb_printf("%ld\t%s\n", size, filename);
#endif
}