From 72e854c3ad7b9004bc0ef82c927ada05ec6938d8 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 24 Jun 2018 00:32:51 -0400 Subject: [PATCH] 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 --- misc/e2image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { -- 1.8.3.1