From: Ján Tomko Date: Tue, 12 Feb 2019 09:35:17 +0000 (+0100) Subject: virsh: reduce the optimism in cmdIOThreadInfo X-Git-Tag: v5.1.0-rc1~104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ce86316a8aea8d906740ec4ccae884e887fab00;p=thirdparty%2Flibvirt.git virsh: reduce the optimism in cmdIOThreadInfo 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 Reviewed-by: John Ferlan --- diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 0ea65e8994..a1c09abf71 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -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; } /*