[libvirt] [PATCH v2] nwfilter: Fix return value of virNWFilterHashTablePut
Eric Blake
eblake at redhat.com
Wed Nov 23 14:41:38 UTC 2011
On 11/23/2011 07:19 AM, Michal Privoznik wrote:
> In libvirt it is common to return value <0 on error not vice versa.
> ---
> diff to v1:
> -check 3rd call as well:
> https://www.redhat.com/archives/libvir-list/2011-November/msg01312.html
>
> src/conf/nwfilter_params.c | 16 +++++++-------
> src/nwfilter/nwfilter_gentech_driver.c | 37 ++++++++++++++-----------------
> src/nwfilter/nwfilter_learnipaddr.c | 5 +---
> 3 files changed, 26 insertions(+), 32 deletions(-)
> @@ -671,7 +668,7 @@ virNWFilterInstantiate(virConnectPtr conn,
> missing_vars,
> useNewFilter,
> driver);
> - if (rc)
> + if (rc < 0)
> goto err_exit;
This hunk means that virNWFilterInstantiate can now return -1, where it
used to return +1. If you're worried about that, then write this as:
if (rc < 0) {
rc = 1;
goto err_exit;
}
But I think we're safe; all the call chains into filter instantiation
are currently checking merely for non-zero values, and it probably won't
be much longer before we also have a further patch to make the overall
virNWFilterInstantiate return -1 on all failure paths.
ACK.
--
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/11d8775b/attachment-0001.sig>
More information about the libvir-list
mailing list