aboutsummaryrefslogtreecommitdiff
path: root/migration/savevm.c
diff options
context:
space:
mode:
authorRoss Lagerwall <ross.lagerwall@citrix.com>2018-02-06 16:30:39 +0000
committerDr. David Alan Gilbert <dgilbert@redhat.com>2018-02-14 10:18:42 +0000
commit96994fd1e4e0da2a3b5d585a58621722199c67c9 (patch)
treee433177839b07a28ecb04fcecb37e19b28a97e9f /migration/savevm.c
parentbec9c64ef7be8063f1192608b83877bc5c9ea217 (diff)
migration/xen: Check return value of qemu_fclose
QEMUFile uses buffered IO so when writing small amounts (such as the Xen device state file), the actual write call and any errors that may occur only happen as part of qemu_fclose(). Therefore, report IO errors when saving the device state under Xen by checking the return value of qemu_fclose(). Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com> Message-Id: <20180206163039.23661-1-ross.lagerwall@citrix.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@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 3f611c02e8..68b652ff76 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2284,8 +2284,7 @@ void qmp_xen_save_devices_state(const char *filename, bool has_live, bool live,
f = qemu_fopen_channel_output(QIO_CHANNEL(ioc));
object_unref(OBJECT(ioc));
ret = qemu_save_device_state(f);
- qemu_fclose(f);
- if (ret < 0) {
+ if (ret < 0 || qemu_fclose(f) < 0) {
error_setg(errp, QERR_IO_ERROR);
} else {
/* libxl calls the QMP command "stop" before calling