aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-03-23 11:49:58 -0500
committerRob Landley <rob@landley.net>2015-03-23 11:49:58 -0500
commit4b77d5419a0f2f4f8fdb9ad39dceddf75305b2a1 (patch)
tree8532a6de34a92200c0833ca6b0a66b4321f1e41d /lib
parent2c7028ad7572d1860c20e3dca2e48a7f6ca2cb00 (diff)
downloadtoybox-4b77d5419a0f2f4f8fdb9ad39dceddf75305b2a1.tar.gz
Tweak of Elliott Hughes's fix for an off by one error in human_readable
(137 returned "137 KB".)
Diffstat (limited to 'lib')
-rw-r--r--lib/lib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/lib.c b/lib/lib.c
index f70d379c..0f2b0120 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -868,8 +868,8 @@ int human_readable(char *buf, unsigned long long num)
{
int end, len;
- len = sprintf(buf, "%lld", num);
- end = ((len-1)%3)+1;
+ len = sprintf(buf, "%lld", num)-1;
+ end = (len%3)+1;
len /= 3;
if (len && end == 1) {