]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: reduce the optimism in cmdIOThreadInfo
authorJán Tomko <jtomko@redhat.com>
Tue, 12 Feb 2019 09:35:17 +0000 (10:35 +0100)
committerJán Tomko <jtomko@redhat.com>
Wed, 13 Feb 2019 12:58:55 +0000 (13:58 +0100)
Instead of using niothreads which defaults to zero, use the common
pattern with a ret varaible set to true just before the cleanup label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
tools/virsh-domain.c

index 0ea65e8994420a3070e2943b5bab8cf541b2700d..a1c09abf71043e2c603a754994ceb238681f39e0 100644 (file)
@@ -7538,6 +7538,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd)
     unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
     virshControlPtr priv = ctl->privData;
     vshTablePtr table = NULL;
+    bool ret = false;
 
     VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
     VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
@@ -7559,6 +7560,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd)
     }
 
     if (niothreads == 0) {
+        ret = true;
         vshPrintExtra(ctl, _("No IOThreads found for the domain"));
         goto cleanup;
     }
@@ -7582,13 +7584,15 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd)
 
     vshTablePrintToStdout(table, ctl);
 
+    ret = true;
+
  cleanup:
     for (i = 0; i < niothreads; i++)
         virDomainIOThreadInfoFree(info[i]);
     VIR_FREE(info);
     vshTableFree(table);
     virshDomainFree(dom);
-    return niothreads >= 0;
+    return ret;
 }
 
 /*