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

Re: [libvirt] [PATCH 1/7] hellolibvirt: Resolve Coverity issues



On 07/11/2013 06:34 AM, John Ferlan wrote:
> Recent changes uncovered a NEGATIVE_RETURNS when processing 'numNames'
> in 'showDomains' in the for loop after a possible -1 return.
> ---
>  examples/hellolibvirt/hellolibvirt.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/examples/hellolibvirt/hellolibvirt.c b/examples/hellolibvirt/hellolibvirt.c
> index 83045b1..2a48681 100644
> --- a/examples/hellolibvirt/hellolibvirt.c
> +++ b/examples/hellolibvirt/hellolibvirt.c
> @@ -90,6 +90,13 @@ showDomains(virConnectPtr conn)
>      numNames = virConnectListAllDomains(conn,
>                                          &nameList,
>                                          flags);
> +    if (numNames == -1) {
> +        ret = 1;

Should we (as an independent patch) tweak this entire example file to
use EXIT_FAILURE instead of '1', to make it more obvious why we deviate
from our normal practice of negative return on failure?

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

Attachment: signature.asc
Description: OpenPGP digital signature


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