From: Theodore Ts'o Date: Sun, 24 Jun 2018 04:32:51 +0000 (-0400) Subject: e2image: calculate progress rate using floating point X-Git-Tag: v1.44.3-rc1~17 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=72e854c3ad7b9004bc0ef82c927ada05ec6938d8;p=tools%2Fe2fsprogs.git e2image: calculate progress rate using floating point One of the divisions used when caluclate the progress rate was being done as an integer instead of floating-point operation. This could cause the end result to not be as accurate as we would like. Fixes-Coverity-Bug: 1297513 Signed-off-by: Theodore Ts'o --- diff --git a/misc/e2image.c b/misc/e2image.c index 83ae633..99a2ed9 100644 --- a/misc/e2image.c +++ b/misc/e2image.c @@ -552,7 +552,7 @@ static void sigint_handler(int unused EXT2FS_ATTR((unused))) #define calc_percent(a, b) ((int) ((100.0 * (((float) (a)) / \ ((float) (b)))) + 0.5)) -#define calc_rate(t, b, d) (((float)(t) / ((1024 * 1024) / (b))) / (d)) +#define calc_rate(t, b, d) (((float)(t) / ((float)(1024 * 1024) / (b))) / (d)) static int print_progress(blk64_t num, blk64_t total) {