[libvirt] [PATCH] nwfilter: Fix return value of virNWFilterHashTablePut
Eric Blake
eblake at redhat.com
Wed Nov 23 13:22:12 UTC 2011
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 at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111123/c52f8b6a/attachment-0001.sig>
More information about the libvir-list
mailing list