mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-07 01:13:49 +00:00
virsh: Simplify control flow for 'qemu-agent-command' command
Signed-off-by: Lin Ma <lma@suse.com>
This commit is contained in:
parent
b9e3c8c5c0
commit
fea03bd31d
@ -9796,19 +9796,17 @@ cmdQemuAgentCommand(vshControl *ctl, const vshCmd *cmd)
|
|||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
const vshCmdOpt *opt = NULL;
|
const vshCmdOpt *opt = NULL;
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
bool pad = false;
|
|
||||||
virJSONValuePtr pretty = NULL;
|
virJSONValuePtr pretty = NULL;
|
||||||
|
|
||||||
dom = virshCommandOptDomain(ctl, cmd, NULL);
|
dom = virshCommandOptDomain(ctl, cmd, NULL);
|
||||||
if (dom == NULL)
|
if (dom == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
while ((opt = vshCommandOptArgv(ctl, cmd, opt))) {
|
while ((opt = vshCommandOptArgv(ctl, cmd, opt)))
|
||||||
if (pad)
|
virBufferAsprintf(&buf, "%s ", opt->data);
|
||||||
virBufferAddChar(&buf, ' ');
|
|
||||||
pad = true;
|
virBufferTrim(&buf, " ", -1);
|
||||||
virBufferAdd(&buf, opt->data, -1);
|
|
||||||
}
|
|
||||||
if (virBufferError(&buf)) {
|
if (virBufferError(&buf)) {
|
||||||
vshError(ctl, "%s", _("Failed to collect command"));
|
vshError(ctl, "%s", _("Failed to collect command"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user