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

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

 



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