From: Seung-Woo Kim Date: Fri, 8 Nov 2024 06:04:17 +0000 (+0900) Subject: Fix report_progress when sent file size is less than 1KB X-Git-Tag: accepted/tools/devbase/tools/legacy/20250527.042524~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=44fd10dbfa4d4952f933407bb6d75f300b0c919f;p=tools%2Flthor.git Fix report_progress when sent file size is less than 1KB When sent file is less than 1KB, there is a divide-by zero error. Check size less than 1KB to fix the issue. Change-Id: Ie73fa6e9151f635a6420153c025654462238498c Signed-off-by: Seung-Woo Kim --- diff --git a/lthor.c b/lthor.c index 38a80d4..e6b284d 100644 --- a/lthor.c +++ b/lthor.c @@ -185,7 +185,8 @@ static void report_progress(thor_device_handle *th, struct thor_data_src *data, char c = progress[(sent_kb/30)%4]; fprintf(stderr, "\x1b[1A\x1b[16C%c sending %6uk/%6uk %3u%% block %-6d", - c, sent_kb, total_kb, ((sent_kb*100)/total_kb), chunk_nmb); + c, sent_kb, total_kb, total_kb ? ((sent_kb*100)/total_kb) : 0, + chunk_nmb); gettimeofday(¤t_time, NULL);