util: remove rounding error where reporting "human sizes".
authorNeilBrown <neilb@suse.de>
Thu, 18 Dec 2014 05:48:15 +0000 (16:48 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 18 Dec 2014 05:58:44 +0000 (16:58 +1100)
commit93d3bd3b28486ae3f933b3f94c81d27565d5e89e
tree8931e48a9de4858fb80a0489a43bc1dd5c8ab289
parent16afb1a5efb59b45db9ee46dad7cc410aabbe90e
util: remove rounding error where reporting "human sizes".

The division
 1<<20 / 200
is not exact, so dividing by this to convert bytes into half-megs
is wrong and results in incorrect output.

As we are doing "long long" arithmetic, there is no risk of an overflow
until we reach 64 petabytes.
So change to
   * 200 / (1<<20).

Reported-by: Jan Echternach <jan@goneko.de>
Resolved-debian-bug: 763917
URL: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=763917
Signed-off-by: NeilBrown <neilb@suse.de>
util.c