The 'other' variable was used to store the parent of the redefined
checkpoint and then the existing version of the currently redefined
checkpoint. Make it less confusing by adding a 'parent' variable for the
first case.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/checkpoint_conf.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c
index b254dce7fd..ea2e77a50a 100644
--- a/src/conf/checkpoint_conf.c
+++ b/src/conf/checkpoint_conf.c
@@ -540,6 +540,7 @@ virDomainCheckpointRedefinePrep(virDomainObjPtr vm,
{
virDomainCheckpointDefPtr def = *defptr;
char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virDomainMomentObjPtr parent = NULL;
virDomainMomentObjPtr other = NULL;
virDomainCheckpointDefPtr otherdef = NULL;
@@ -558,12 +559,13 @@ virDomainCheckpointRedefinePrep(virDomainObjPtr vm,
if (virDomainCheckpointAlignDisks(def) < 0)
return -1;
- if (def->parent.parent_name)
- other = virDomainCheckpointFindByName(vm->checkpoints,
- def->parent.parent_name);
- if (other == virDomainCheckpointGetCurrent(vm->checkpoints)) {
- *update_current = true;
- virDomainCheckpointSetCurrent(vm->checkpoints, NULL);
+ if (def->parent.parent_name &&
+ (parent = virDomainCheckpointFindByName(vm->checkpoints,
+ def->parent.parent_name))) {
+ if (parent == virDomainCheckpointGetCurrent(vm->checkpoints)) {
+ *update_current = true;
+ virDomainCheckpointSetCurrent(vm->checkpoints, NULL);
+ }
}
other = virDomainCheckpointFindByName(vm->checkpoints, def->parent.name);
--
2.21.0