summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2008-06-19 14:39:49 +0000
committerDaniel Veillard <veillard@redhat.com>2008-06-19 14:39:49 +0000
commit1ec7cccbd344534031c096bccbf6401fa642e964 (patch)
treec3bb2859f90ca858e72cae78250d83d94fd25554
parentvirsh fails to read files larger than BUFSIZ bytes (diff)
downloadlibvirt-1ec7cccbd344534031c096bccbf6401fa642e964.tar.gz
libvirt-1ec7cccbd344534031c096bccbf6401fa642e964.tar.bz2
libvirt-1ec7cccbd344534031c096bccbf6401fa642e964.zip
fix a couple of List functions for max = 0 issues
* src/xen_internal.c src/xend_internal.c: fix a couple of issues for List functions where max given is 0 Daniel
-rw-r--r--ChangeLog5
-rw-r--r--src/xen_internal.c5
-rw-r--r--src/xend_internal.c10
3 files changed, 17 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 463d9e240..bbc6816f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jun 19 16:29:33 CEST 2008 Daniel Veillard <veillard@redhat.com>
+
+ * src/xen_internal.c src/xend_internal.c: fix a couple of issues
+ for List functions where max given is 0
+
Thu Jun 19 13:50:41 CEST 2008 Jim Meyering <meyering@redhat.com>
virsh fails to read files larger than BUFSIZ bytes
diff --git a/src/xen_internal.c b/src/xen_internal.c
index 6a5fd81b5..0d8e76985 100644
--- a/src/xen_internal.c
+++ b/src/xen_internal.c
@@ -2554,9 +2554,12 @@ xenHypervisorListDomains(virConnectPtr conn, int *ids, int maxids)
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);
diff --git a/src/xend_internal.c b/src/xend_internal.c
index 012e0c49a..aaaf45316 100644
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -3330,7 +3330,10 @@ xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids)
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(virConnectPtr conn, char **const names, int maxn
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;