Re: [PATCH] nwfilter: Fix return value of virNWFilterHashTablePut

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

 



On 11/23/2011 05:33 AM, Michal Privoznik wrote:
> In libvirt it is common to return value <0 on error not vice versa.
> ---
>  src/conf/nwfilter_params.c             |   16 ++++++++--------
>  src/nwfilter/nwfilter_gentech_driver.c |    4 ++--
>  src/nwfilter/nwfilter_learnipaddr.c    |    2 +-
>  3 files changed, 11 insertions(+), 11 deletions(-)

> 
> --- a/src/nwfilter/nwfilter_gentech_driver.c
> +++ b/src/nwfilter/nwfilter_gentech_driver.c
> @@ -343,10 +343,10 @@ virNWFilterCreateVarsFrom(virNWFilterHashTablePtr vars1,
>          return NULL;
>      }
>  
> -    if (virNWFilterHashTablePutAll(vars1, res))
> +    if (virNWFilterHashTablePutAll(vars1, res) < 0)
>          goto err_exit;
>  
> -    if (virNWFilterHashTablePutAll(vars2, res))
> +    if (virNWFilterHashTablePutAll(vars2, res) < 0)
>          goto err_exit;
>  
>      return res;

This only fixes 2 of the three affected call sites (the third wasn't
even checking for failure, so that also needs fixing).

> diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
> index 2e373a6..425e8a2 100644
> --- a/src/nwfilter/nwfilter_learnipaddr.c
> +++ b/src/nwfilter/nwfilter_learnipaddr.c
> @@ -800,7 +800,7 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
>          goto err_free_req;
>      }
>  
> -    if (virNWFilterHashTablePutAll(filterparams, ht))
> +    if (virNWFilterHashTablePutAll(filterparams, ht) < 0)

You'll need to rebase this one on top of Stefan's recent patch, and take
out the FIXME he just added.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]