[libvirt] [PATCH] Strict check when listing domains

Eduardo Otubo otubo at linux.vnet.ibm.com
Mon Mar 29 23:04:23 UTC 2010


I am really sorry. I sent an older version of the patch, here is the 
correct one.


Eric Blake wrote:
> 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.
> 


-- 
Eduardo Otubo
Software Engineer
Linux Technology Center
IBM Systems & Technology Group
Mobile: +55 19 8135 0885
eotubo at linux.vnet.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: phyp_listdomains.patch
Type: text/x-patch
Size: 2018 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100329/fb7c370b/attachment-0001.bin>


More information about the libvir-list mailing list