提交 3ce86316 编写于 作者: J Ján Tomko

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: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 bf688a00
...@@ -7538,6 +7538,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) ...@@ -7538,6 +7538,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd)
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT; unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
virshControlPtr priv = ctl->privData; virshControlPtr priv = ctl->privData;
vshTablePtr table = NULL; vshTablePtr table = NULL;
bool ret = false;
VSH_EXCLUSIVE_OPTIONS_VAR(current, live); VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
VSH_EXCLUSIVE_OPTIONS_VAR(current, config); VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
...@@ -7559,6 +7560,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) ...@@ -7559,6 +7560,7 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd)
} }
if (niothreads == 0) { if (niothreads == 0) {
ret = true;
vshPrintExtra(ctl, _("No IOThreads found for the domain")); vshPrintExtra(ctl, _("No IOThreads found for the domain"));
goto cleanup; goto cleanup;
} }
...@@ -7582,13 +7584,15 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd) ...@@ -7582,13 +7584,15 @@ cmdIOThreadInfo(vshControl *ctl, const vshCmd *cmd)
vshTablePrintToStdout(table, ctl); vshTablePrintToStdout(table, ctl);
ret = true;
cleanup: cleanup:
for (i = 0; i < niothreads; i++) for (i = 0; i < niothreads; i++)
virDomainIOThreadInfoFree(info[i]); virDomainIOThreadInfoFree(info[i]);
VIR_FREE(info); VIR_FREE(info);
vshTableFree(table); vshTableFree(table);
virshDomainFree(dom); virshDomainFree(dom);
return niothreads >= 0; return ret;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册