1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

qemu: Check return status for virDomainGraphicsListenSetAddress

Recent refactors in the vbox code to check the return status for the
function tipped Coverity's scales of justice for any functions that
do not check status - such as this one.

While I'm at it, since the call is essentially the same other than
whether starting from val or val+1 when val[0] = '[', just adjust
the val pointer by one and have one call instead of two.

Additionally, the call to virDomainGraphicsListenGetAddress is redundant
since it checking that the address field got filled.  It's a leftover
from the strndup -> ListenSetAddress conversion (commit id 'ef79fb5b5')

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2016-02-09 06:24:33 -05:00
parent 7b3adac4cf
commit 336d4dace4

View File

@ -11920,12 +11920,8 @@ qemuParseCommandLineVnc(virDomainDefPtr def,
goto cleanup;
}
if (val[0] == '[')
virDomainGraphicsListenSetAddress(vnc, 0,
val+1, tmp-(val+1), true);
else
virDomainGraphicsListenSetAddress(vnc, 0,
val, tmp-val, true);
if (!virDomainGraphicsListenGetAddress(vnc, 0))
val++;
if (virDomainGraphicsListenSetAddress(vnc, 0, val, tmp-val, true) < 0)
goto cleanup;
if (*opts == ',') {