[libvirt] [PATCH] network_conf.c: correct the value of the 'result' variable

Laine Stump laine at laine.org
Fri Nov 1 08:55:07 UTC 2013


On 10/31/2013 07:18 PM, Eric Blake wrote:
> On 10/31/2013 06:20 PM, Hongwei Bi wrote:
>> The result variable in virNetworkDNSDefFormat() function should be
>> initialized to -1 at first,only in this way can we use it properly.
>>
>> Signed-off-by: Hongwei Bi <hwbi2008 at gmail.com>
>> ---
>>  src/conf/network_conf.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
> NACK.  After applying your patch, 'make check' fails:

Beyond that, a quick reading of the function shows that 1) all
conditions that lead to "goto out" are actually success conditions, and
2) no error checking is done in the function (it's all just using
virBuffer calls, and those errors are checked at the end when the buffer
is transferred into a char*).

Although a great majority of the functions in libvirt use the convention
of initializing the return value to -1 then setting it to 0 if we reach
the end, this is not universal. As it stands now, this function may not
follow the libvirt convention, but it is correct.




More information about the libvir-list mailing list