Index: src/xen_internal.c =================================================================== RCS file: /data/cvs/libxen/src/xen_internal.c,v retrieving revision 1.121 diff -u -p -r1.121 xen_internal.c --- src/xen_internal.c 6 Jun 2008 11:09:57 -0000 1.121 +++ src/xen_internal.c 17 Jun 2008 09:48:17 -0000 @@ -2554,9 +2554,12 @@ xenHypervisorListDomains(virConnectPtr c priv = (xenUnifiedPrivatePtr) conn->privateData; if (priv->handle < 0 || - (ids == NULL) || (maxids < 1)) + (ids == NULL) || (maxids < 0)) return (-1); + if (maxids == 0) + return(0); + if (!(XEN_GETDOMAININFOLIST_ALLOC(dominfos, maxids))) { virXenError(conn, VIR_ERR_NO_MEMORY, "allocating %d domain info", maxids); Index: src/xend_internal.c =================================================================== RCS file: /data/cvs/libxen/src/xend_internal.c,v retrieving revision 1.198 diff -u -p -r1.198 xend_internal.c --- src/xend_internal.c 9 Jun 2008 12:16:03 -0000 1.198 +++ src/xend_internal.c 17 Jun 2008 09:48:17 -0000 @@ -3330,7 +3330,10 @@ xenDaemonListDomains(virConnectPtr conn, struct sexpr *_for_i, *node; long id; - if ((ids == NULL) || (maxids <= 0)) + if (maxids == 0) + return(0); + + if ((ids == NULL) || (maxids < 0)) goto error; root = sexpr_get(conn, "/xend/domain"); if (root == NULL) @@ -4219,8 +4222,11 @@ int xenDaemonListDefinedDomains(virConne if (priv->xendConfigVersion < 3) return(-1); - if ((names == NULL) || (maxnames <= 0)) + if ((names == NULL) || (maxnames < 0)) goto error; + if (maxnames == 0) + return(0); + root = sexpr_get(conn, "/xend/domain?state=halted"); if (root == NULL) goto error;