[libvirt] [PATCH v2 2/3] qemu: Check return status for virDomainGraphicsListenSetAddress
John Ferlan
jferlan at redhat.com
Wed Feb 10 20:18:12 UTC 2016
On 02/10/2016 11:55 AM, Laine Stump wrote:
> On 02/10/2016 08:05 AM, John Ferlan wrote:
>> 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.
>>
>> Signed-off-by: John Ferlan <jferlan at redhat.com>
>> ---
>> src/qemu/qemu_command.c | 8 +++-----
>> 1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
>> index d09a063..9d530b6 100644
>> --- a/src/qemu/qemu_command.c
>> +++ b/src/qemu/qemu_command.c
>> @@ -11920,11 +11920,9 @@ 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);
>> + val++;
>> + if (virDomainGraphicsListenSetAddress(vnc, 0, val, tmp-val,
>> true) < 0)
>> + goto cleanup;
>> if (!virDomainGraphicsListenGetAddress(vnc, 0))
>> goto cleanup;
>>
>
> Jan was correct when he suggested that the above call to
> virDomainGraphicsListenGetAddress() is now redundant - it is only there
> to force an early return if there was a failure in setting the address,
> and you're now checking for that already.
>
Old age myopia... I was focused on just the SetListAddress return value
not being checked... I'll remove the redundant ListGetAddress call.
John
More information about the libvir-list
mailing list