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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
>> ---
>>  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.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]