diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2016-03-09 10:10:55 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-03-14 13:42:47 +0100 |
commit | af83da99d6f3dc5e50db783864effb4ae81f15bc (patch) | |
tree | f58f497ab9bb11eb21e3dc4d21920e62b157ba47 /print-tree.c | |
parent | 9f76654de8a8c573e957c3f6b0877724f8c04bd9 (diff) |
btrfs-progs: util: Fix a wrong unit of pretty_size
If parameter for pretty_size is smaller than default base(1024),
pretty_size() will output wrong unit.
For example, pretty_size(1008) will output '0.98B' not '1008B' or
'0.98KiB'.
The cause is, for default base and auto-detect unit, base will be 1024
but num_divs is still 0, last result will still be divided by base,
causing the bug.
Fix it by checking num_divs in default case, and if num_divs is 0,
change base to 1.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'print-tree.c')
0 files changed, 0 insertions, 0 deletions