[libvirt] [PATCH] Strict check when listing domains
Eric Blake
eblake at redhat.com
Thu Mar 25 21:25:36 UTC 2010
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 at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 323 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100325/45e146c7/attachment-0001.sig>
More information about the libvir-list
mailing list