Separate the 'else if' branches into nested conditions so that it's more
obvious when we'll be adding additional checks later.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_snapshot.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 67180a2b10..81085bf4bd 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -582,18 +582,22 @@ qemuSnapshotPrepareDiskExternal(virDomainObj *vm,
_("unable to stat for disk %s: %s"),
snapdisk->name, snapdisk->src->path);
return -1;
- } else if (reuse) {
+ }
+
+ if (reuse) {
virReportSystemError(err,
_("missing existing file for disk %s:
%s"),
snapdisk->name, snapdisk->src->path);
return -1;
}
- } else if (!S_ISBLK(st.st_mode) && st.st_size && !reuse) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("external snapshot file for disk %s already "
- "exists and is not a block device: %s"),
- snapdisk->name, snapdisk->src->path);
- return -1;
+ } else {
+ if (!S_ISBLK(st.st_mode) && st.st_size && !reuse) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("external snapshot file for disk %s already "
+ "exists and is not a block device: %s"),
+ snapdisk->name, snapdisk->src->path);
+ return -1;
+ }
}
}
--
2.31.1