From 3ce86316a8aea8d906740ec4ccae884e887fab00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Tue, 12 Feb 2019 10:35:17 +0100 Subject: [PATCH] virsh: reduce the optimism in cmdIOThreadInfo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tools/virsh-domain.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } /*