From: Peter Krempa <pkrempa(a)redhat.com>
The 'ret' variable is set to 0 before a call which can theoretically
fail. Not in practice really as the failure scenarion includes only
object initialization.
Since the code already has another variable for checking monitor returns
use that one properly so that the code makes sense.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_snapshot.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index ac05156e17..4f914b385c 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -592,16 +592,15 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *driver,
goto cleanup;
}
- ret = 0;
} else {
if (qemuDomainObjEnterMonitorAsync(vm, VIR_ASYNC_JOB_SNAPSHOT) < 0) {
resume = false;
goto cleanup;
}
- ret = qemuMonitorCreateSnapshot(priv->mon, snap->def->name);
+ rv = qemuMonitorCreateSnapshot(priv->mon, snap->def->name);
qemuDomainObjExitMonitor(vm);
- if (ret < 0)
+ if (rv < 0)
goto cleanup;
}
@@ -617,6 +616,8 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *driver,
resume = false;
}
+ ret = 0;
+
cleanup:
if (resume && virDomainObjIsActive(vm) &&
qemuProcessStartCPUs(driver, vm,
--
2.49.0