提交 fea03bd3 编写于 作者: L Lin Ma 提交者: Peter Krempa

virsh: Simplify control flow for 'qemu-agent-command' command

Signed-off-by: NLin Ma <lma@suse.com>
上级 b9e3c8c5
......@@ -9796,19 +9796,17 @@ cmdQemuAgentCommand(vshControl *ctl, const vshCmd *cmd)
unsigned int flags = 0;
const vshCmdOpt *opt = NULL;
virBuffer buf = VIR_BUFFER_INITIALIZER;
bool pad = false;
virJSONValuePtr pretty = NULL;
dom = virshCommandOptDomain(ctl, cmd, NULL);
if (dom == NULL)
goto cleanup;
while ((opt = vshCommandOptArgv(ctl, cmd, opt))) {
if (pad)
virBufferAddChar(&buf, ' ');
pad = true;
virBufferAdd(&buf, opt->data, -1);
}
while ((opt = vshCommandOptArgv(ctl, cmd, opt)))
virBufferAsprintf(&buf, "%s ", opt->data);
virBufferTrim(&buf, " ", -1);
if (virBufferError(&buf)) {
vshError(ctl, "%s", _("Failed to collect command"));
goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册