From dab5d10763251232d92e0a3dff9ef52dc5faa252 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Tue, 23 Jan 2007 12:28:38 +0000 Subject: [PATCH] Mon Jan 23 12:28:42 IST 2007 Mark McLoughlin Issues pointed out by Karel Zak * src/virsh.c: fix up some syntax strings, use BUFSIZ and free names returned from virConnectListDefinedDomains() --- ChangeLog | 7 +++++++ src/virsh.c | 13 ++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b690de7db..886c6e59ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Jan 23 12:28:42 IST 2007 Mark McLoughlin + + Issues pointed out by Karel Zak + + * src/virsh.c: fix up some syntax strings, use BUFSIZ + and free names returned from virConnectListDefinedDomains() + Mon Jan 22 15:41:52 EST 2007 Daniel Berrange * src/virsh.c: Fix crash in 'connect' command by ensuring diff --git a/src/virsh.c b/src/virsh.c index b04f88e137..857c60436e 100644 --- a/src/virsh.c +++ b/src/virsh.c @@ -309,7 +309,7 @@ cmdConnect(vshControl * ctl, vshCmd * cmd) * "list" command */ static vshCmdInfo info_list[] = { - {"syntax", "list"}, + {"syntax", "list [--inactive | --all]"}, {"help", gettext_noop("list domains")}, {"desc", gettext_noop("Returns list of domains.")}, {NULL, NULL} @@ -419,8 +419,10 @@ cmdList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) virDomainPtr dom = virDomainLookupByName(ctl->conn, names[i]); /* this kind of work with domains is not atomic operation */ - if (!dom) + if (!dom) { + free(names[i]); continue; + } ret = virDomainGetInfo(dom, &info); id = virDomainGetID(dom); @@ -439,6 +441,7 @@ cmdList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) } virDomainFree(dom); + free(names[i]); } if (ids) free(ids); @@ -546,7 +549,7 @@ cmdCreate(vshControl * ctl, vshCmd * cmd) char *from; int found; int ret = TRUE; - char buffer[4096]; + char buffer[BUFSIZ]; int fd, l; if (!vshConnectionUsability(ctl, ctl->conn, TRUE)) @@ -601,7 +604,7 @@ cmdDefine(vshControl * ctl, vshCmd * cmd) char *from; int found; int ret = TRUE; - char buffer[4096]; + char buffer[BUFSIZ]; int fd, l; if (!vshConnectionUsability(ctl, ctl->conn, TRUE)) @@ -677,7 +680,7 @@ cmdUndefine(vshControl * ctl, vshCmd * cmd) * "start" command */ static vshCmdInfo info_start[] = { - {"syntax", "start a domain "}, + {"syntax", "start "}, {"help", gettext_noop("start a (previously defined) inactive domain")}, {"desc", gettext_noop("Start a domain.")}, {NULL, NULL}