[libvirt] [PATCH] qemu: Fix return value of qemuDomainGetBlockJobInfo

Michal Privoznik mprivozn at redhat.com
Mon Jan 4 14:53:32 UTC 2016


While reviewing 1b43885d1784640 I've noticed a virReportError()
followed by a goto endjob; without setting the correct return
value. Problem is, if block job is so fast that it's bandwidth
does not fit into ulong, an error is reported. However, by that
time @ret is already set to 1 which means success. Since the
scenario can be hardly considered successful, we should return a
value meaning error.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_driver.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 304165c..1161aa0 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16546,6 +16546,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom,
         virReportError(VIR_ERR_OVERFLOW,
                        _("bandwidth %llu cannot be represented in result"),
                        rawInfo.bandwidth);
+        ret = -1;
         goto endjob;
     }
 
-- 
2.4.10




More information about the libvir-list mailing list