From: Shaleen Bathla Date: Wed, 26 Apr 2023 11:28:32 +0000 (+0530) Subject: tools: virsh-domain: refactor variable initialization X-Git-Tag: v9.4.0-rc1~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51cfca2210cd11d49ab72c104834f0e6718abd12;p=thirdparty%2Flibvirt.git tools: virsh-domain: refactor variable initialization Signed-off-by: Shaleen Bathla Reviewed-by: Michal Privoznik Reviewed-by: Martin Kletzander --- diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index db47d63d85..e30510a07d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -1722,12 +1722,10 @@ static void virshPrintJobProgress(const char *label, unsigned long long remaining, unsigned long long total) { - int progress; + int progress = 100; - if (remaining == 0) { - /* migration has completed */ - progress = 100; - } else { + /* if remaining == 0 migration has completed */ + if (remaining != 0) { /* use float to avoid overflow */ progress = (int)(100.0 - remaining * 100.0 / total); if (progress >= 100) {