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
---
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(¶ms[nparams++],
VIR_DOMAIN_BLOCK_COPY_BANDWIDTH,
--
1.8.3.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list