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

Re: [libvirt] [PATCH] Strict check when listing domains



On 03/24/2010 11:19 AM, Eduardo Otubo wrote:

>      /* exit early if there are no domains */
> -    if (nids == 0)
> +    if (nids_numdomains == 0 || nids_listdomains == 0
> +        || nids_numdomains != nids_listdomains)
>          return 0;

Should we be reporting an error here...

>  
> -    if (VIR_ALLOC_N(ids, nids) < 0) {
> +    if (VIR_ALLOC_N(ids, nids_listdomains) < 0) {
>          virReportOOMError();
>          goto err;
>      }
>  
> -    if ((nids = phypListDomainsGeneric(conn, ids, nids, 1)) < 0)
> -        goto err;
> -
> -    /* exit early if there are no domains */
> -    /* FIXME: phypNumDomainsGeneric() returned > 0 but phypListDomainsGeneric()
> -     *        returned 0. indicates this an error condition?
> -     *        an even stricter check would be to treat
> -     *
> -     *          phypNumDomainsGeneric() != phypListDomainsGeneric()
> -     *
> -     *        as an error */

...given this comment?  You treated it as an early exit of 0, even if
both values were non-zero.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
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]