]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tools: virsh-domain: refactor variable initialization
authorShaleen Bathla <shaleen.bathla@oracle.com>
Wed, 26 Apr 2023 11:28:32 +0000 (16:58 +0530)
committerMartin Kletzander <mkletzan@redhat.com>
Tue, 2 May 2023 13:52:20 +0000 (15:52 +0200)
Signed-off-by: Shaleen Bathla <shaleen.bathla@oracle.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
tools/virsh-domain.c

index db47d63d85fd3292b0803681167d142e95604f09..e30510a07dddf06f02991a03bcf7908a90c9f117 100644 (file)
@@ -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) {