]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemuDomainGetGuestInfo: Exit early if getting info fails
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 1 Dec 2020 10:47:13 +0000 (11:47 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 2 Dec 2020 14:33:53 +0000 (15:33 +0100)
commitb46ec55d53cbe97e359a418168bd7bc82677ffcc
tree184609f81e910e781905e77b355e9345f7a0f013
parent143d2e9bde65fd204e9f13379aff65f34ecd14c9
qemuDomainGetGuestInfo: Exit early if getting info fails

If there is an error getting info from guest agent, then the
control on qemuDomainGetGuestInfo() jumps onto 'exitagent' label
and subsequently continues on 'endagentjob'. Both labels are hit
also in success case too. The control then continues by
attempting to match fetched info (e.g. disk addresses) with
domain def. But this is needless - the API will return error
regardless.

To return early from the function move both 'exitagent' and
'endagentjob' labels at the end of the function and jump straight
onto 'cleanup' afterwards. This allows us to set 'ret = 0' later
- only when we know we succeeded.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_driver.c