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 <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Ján Tomko 2019-02-12 10:35:17 +01:00
parent bf688a0067
commit 3ce86316a8

View 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;
}
/*