[libvirt] [PATCH] qemu: return -1 on error paths in qemuDomainSaveImageStartVM

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Thu Jan 28 12:49:48 UTC 2016


The error paths after fix suppose ret == -1 as at the
beginning of the function.

The better fix would be not to touch 'ret' at all until
the end of the function where it is set to 0. Thus we'd
better introduce some 'rc' variable to hold return
values of called functions.
---
 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 351e529..dfbf846 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6790,6 +6790,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
         virDomainAuditStart(vm, "restored", false);
         goto cleanup;
     }
+    ret = -1;
 
     event = virDomainEventLifecycleNewFromObj(vm,
                                      VIR_DOMAIN_EVENT_STARTED,
-- 
1.8.3.1




More information about the libvir-list mailing list