aboutsummaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2018-06-24 00:32:51 -0400
committerTheodore Ts'o <tytso@mit.edu>2018-06-24 00:32:51 -0400
commit72e854c3ad7b9004bc0ef82c927ada05ec6938d8 (patch)
tree3c727ef02b35d6ca762177ec89d0a8bed313b803 /misc
parent48a54b0f51a440cd6379ba9df82a9e726cad128c (diff)
downloadandroid_external_e2fsprogs-72e854c3ad7b9004bc0ef82c927ada05ec6938d8.tar.gz
android_external_e2fsprogs-72e854c3ad7b9004bc0ef82c927ada05ec6938d8.tar.bz2
android_external_e2fsprogs-72e854c3ad7b9004bc0ef82c927ada05ec6938d8.zip
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 <tytso@mit.edu>
Diffstat (limited to 'misc')
-rw-r--r--misc/e2image.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/misc/e2image.c b/misc/e2image.c
index 83ae6335..99a2ed9e 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)
{