]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
virsh: blockCopy: Add missing jump on error path
authorLuyao Huang <lhuang@redhat.com>
Fri, 27 Mar 2015 09:56:29 +0000 (17:56 +0800)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 30 Mar 2015 14:42:22 +0000 (16:42 +0200)
The overflow check for the bandwidth parameter did not jump to the
cleanup label.

Additionally virsh should use vshError instead of virReportError.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1206987

Signed-off-by: Luyao Huang <lhuang@redhat.com>
tools/virsh-domain.c

index b39f4b68e3dc055d42fe3afb85afa4a3fa17c8cf..9bbb964c548fe663d075b4c4886175a93d527882 100644 (file)
@@ -2253,9 +2253,8 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
                  * ullong bytes/s; make sure we don't overflow */
                 unsigned long long limit = MIN(ULONG_MAX, ULLONG_MAX >> 20);
                 if (bandwidth > limit) {
-                    virReportError(VIR_ERR_OVERFLOW,
-                                   _("bandwidth must be less than %llu"),
-                                   ULLONG_MAX >> 20);
+                    vshError(ctl, _("bandwidth must be less than %llu"), limit);
+                    goto cleanup;
                 }
                 if (virTypedParameterAssign(&params[nparams++],
                                             VIR_DOMAIN_BLOCK_COPY_BANDWIDTH,