]> git.ipfire.org Git - thirdparty/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)
committerCole Robinson <crobinso@redhat.com>
Tue, 28 Apr 2015 15:07:03 +0000 (11:07 -0400)
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>
(cherry picked from commit 390f218b83513a00b81549eb66854d8b263cb014)

tools/virsh-domain.c

index 0abd1b561b0b9d1c3944ad4c05f61f0c065f7677..e9028adf2bdf261d754ae4a4f8831b914391d17e 100644 (file)
@@ -2250,9 +2250,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,