migration: use qemu_file_get_error() return value when possible
Signed-off-by: Juan Quintela <quintela@redhat.com>
diff --git a/arch_init.c b/arch_init.c
index 9128be0..98daaf3 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -371,6 +371,7 @@
{
ram_addr_t addr;
int flags;
+ int error;
if (version_id < 3 || version_id > 4) {
return -EINVAL;
@@ -451,8 +452,9 @@
qemu_get_buffer(f, host, TARGET_PAGE_SIZE);
}
- if (qemu_file_get_error(f)) {
- return -EIO;
+ error = qemu_file_get_error(f);
+ if (error) {
+ return error;
}
} while (!(flags & RAM_SAVE_FLAG_EOS));