提交 1ec7cccb 编写于 作者: D Daniel Veillard

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
上级 e09fab39
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> Thu Jun 19 13:50:41 CEST 2008 Jim Meyering <meyering@redhat.com>
virsh fails to read files larger than BUFSIZ bytes virsh fails to read files larger than BUFSIZ bytes
......
...@@ -2554,9 +2554,12 @@ xenHypervisorListDomains(virConnectPtr conn, int *ids, int maxids) ...@@ -2554,9 +2554,12 @@ xenHypervisorListDomains(virConnectPtr conn, int *ids, int maxids)
priv = (xenUnifiedPrivatePtr) conn->privateData; priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->handle < 0 || if (priv->handle < 0 ||
(ids == NULL) || (maxids < 1)) (ids == NULL) || (maxids < 0))
return (-1); return (-1);
if (maxids == 0)
return(0);
if (!(XEN_GETDOMAININFOLIST_ALLOC(dominfos, maxids))) { if (!(XEN_GETDOMAININFOLIST_ALLOC(dominfos, maxids))) {
virXenError(conn, VIR_ERR_NO_MEMORY, "allocating %d domain info", virXenError(conn, VIR_ERR_NO_MEMORY, "allocating %d domain info",
maxids); maxids);
......
...@@ -3330,7 +3330,10 @@ xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids) ...@@ -3330,7 +3330,10 @@ xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids)
struct sexpr *_for_i, *node; struct sexpr *_for_i, *node;
long id; long id;
if ((ids == NULL) || (maxids <= 0)) if (maxids == 0)
return(0);
if ((ids == NULL) || (maxids < 0))
goto error; goto error;
root = sexpr_get(conn, "/xend/domain"); root = sexpr_get(conn, "/xend/domain");
if (root == NULL) if (root == NULL)
...@@ -4219,8 +4222,11 @@ int xenDaemonListDefinedDomains(virConnectPtr conn, char **const names, int maxn ...@@ -4219,8 +4222,11 @@ int xenDaemonListDefinedDomains(virConnectPtr conn, char **const names, int maxn
if (priv->xendConfigVersion < 3) if (priv->xendConfigVersion < 3)
return(-1); return(-1);
if ((names == NULL) || (maxnames <= 0)) if ((names == NULL) || (maxnames < 0))
goto error; goto error;
if (maxnames == 0)
return(0);
root = sexpr_get(conn, "/xend/domain?state=halted"); root = sexpr_get(conn, "/xend/domain?state=halted");
if (root == NULL) if (root == NULL)
goto error; goto error;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册