[libvirt] [PATCH] virsh: fix forget jump to clean up when set a big bandwidth

Luyao Huang lhuang at redhat.com
Fri Mar 27 09:56:29 UTC 2015


We already have a check for this, just add a jump to cleanup and change to 
use vshError instead of virReportError.

Signed-off-by: Luyao Huang <lhuang at redhat.com>
---
 tools/virsh-domain.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 1d8225c..33fbf9c 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -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,
-- 
1.8.3.1




More information about the libvir-list mailing list