From 1b2f3d332c25d50b4e369785fb677c29e641ce9d Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Wed, 15 Dec 2021 11:22:43 +0000 Subject: [PATCH] fix: overflow on calculate the percentage of progress Signed-off-by: Jianhui Zhao --- src/filectl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filectl.c b/src/filectl.c index 5c60a74..aed6099 100644 --- a/src/filectl.c +++ b/src/filectl.c @@ -63,7 +63,7 @@ static u_int32_t update_progress(uint8_t *buf) memcpy(&remain, buf, 4); printf("%100c\r", ' '); - printf(" %lu%% %s %.3fs\r", (total_size - remain) * 100UL / total_size, + printf(" %llu%% %s %.3fs\r", (total_size - remain) * 100ULL / total_size, format_size(total_size - remain), (now.tv_sec + now.tv_usec / 1000.0 / 1000) - (start_time.tv_sec + start_time.tv_usec / 1000.0 / 1000)); fflush(stdout);