summary refs log tree commit diff stats
path: root/migration/savevm.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2023-10-25 11:11:17 +0200
committerJuan Quintela <quintela@redhat.com>2023-10-31 08:44:33 +0100
commitbe07a0ed22cf10ede7330efbb4818f5896cd6fe3 (patch)
tree26437bc4d51707ae334be4aad3f69221ec62f5b0 /migration/savevm.c
parent0f8596180a304182d4fcf8686b73355de9f37a5d (diff)
downloadfocaccia-qemu-be07a0ed22cf10ede7330efbb4818f5896cd6fe3.tar.gz
focaccia-qemu-be07a0ed22cf10ede7330efbb4818f5896cd6fe3.zip
qemu-file: Make qemu_fflush() return errors
This let us simplify code of this shape.

   qemu_fflush(f);
   int ret = qemu_file_get_error(f);
   if (ret) {
      return ret;
   }

into:

   int ret = qemu_fflush(f);
   if (ret) {
      return ret;
   }

I updated all callers where there is any error check.
qemu_fclose() don't need to check for f->last_error because
qemu_fflush() returns it at the beggining of the function.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Juan Quintela <quintela@redhat.com>

Message-ID: <20231025091117.6342-13-quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration/savevm.c')
-rw-r--r--migration/savevm.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/migration/savevm.c b/migration/savevm.c
index 9ec78abd53..c7835e9c73 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1583,8 +1583,7 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only,
     }
 
 flush:
-    qemu_fflush(f);
-    return 0;
+    return qemu_fflush(f);
 }
 
 /* Give an estimate of the amount left to be transferred,