From: Alex Jia Date: Mon, 27 Aug 2012 05:58:46 +0000 (+0800) Subject: virsh: fix missing return value X-Git-Tag: v0.10.0~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34c5ab9566b901abcdba00f62ff41fd0857e8833;p=thirdparty%2Flibvirt.git virsh: fix missing return value Although virsh command raises a correct error information, the command status returns 0(true), this patch is used for fixing this issue. Signed-off-by: Alex Jia --- diff --git a/tools/virsh-host.c b/tools/virsh-host.c index da6089518c..2f3b41399b 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -701,11 +701,13 @@ cmdQemuAgentCommand(vshControl *ctl, const vshCmd *cmd) judge = vshCommandOptInt(cmd, "timeout", &timeout); if (judge < 0) { vshError(ctl, "%s", _("timeout number has to be a number")); + goto cleanup; } else if (judge > 0) { judge = 1; } if (judge && timeout < 1) { vshError(ctl, "%s", _("timeout must be positive")); + goto cleanup; } if (vshCommandOptBool(cmd, "async")) { @@ -719,6 +721,7 @@ cmdQemuAgentCommand(vshControl *ctl, const vshCmd *cmd) if (judge > 1) { vshError(ctl, "%s", _("timeout, async and block options are exclusive")); + goto cleanup; } result = virDomainQemuAgentCommand(dom, guest_agent_cmd, timeout, flags);