This was the only caller for read only files. So change the test for an assert in qemu_fflush().
Signed-off-by: Juan Quintela <quint...@redhat.com> --- migration/qemu-file.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 7a5c1a5e32..38984504ba 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -272,9 +272,7 @@ static void qemu_iovec_release_ram(QEMUFile *f) */ void qemu_fflush(QEMUFile *f) { - if (!qemu_file_is_writable(f)) { - return; - } + g_assert(qemu_file_is_writable(f)); if (qemu_file_get_error(f)) { return; @@ -363,7 +361,9 @@ static ssize_t coroutine_mixed_fn qemu_fill_buffer(QEMUFile *f) int qemu_fclose(QEMUFile *f) { int ret, ret2; - qemu_fflush(f); + if (qemu_file_is_writable(f)) { + qemu_fflush(f); + } ret = qemu_file_get_error(f); ret2 = qio_channel_close(f->ioc, NULL); -- 2.40.1