diff options
| author | Daniel P. Berrangé <berrange@redhat.com> | 2025-08-01 18:02:11 +0100 |
|---|---|---|
| committer | Peter Xu <peterx@redhat.com> | 2025-10-03 09:48:02 -0400 |
| commit | a5bc1ccca9596ecbf57b05bed10bd39e8854e475 (patch) | |
| tree | cc71ddbee528ca1d966eb48a1be47f61a37d8739 /migration/qemu-file.c | |
| parent | 300a87c502c4ba7ffc7720d8f3583e3d1a68348a (diff) | |
| download | focaccia-qemu-a5bc1ccca9596ecbf57b05bed10bd39e8854e475.tar.gz focaccia-qemu-a5bc1ccca9596ecbf57b05bed10bd39e8854e475.zip | |
migration: simplify error reporting after channel read
The code handling the return value of qio_channel_read proceses len == 0 (EOF) separately from len < 1 (error), but in both cases ends up calling qemu_file_set_error_obj() with -EIO as the errno. This logic can be merged into one codepath to simplify it. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Prasad Pandit <pjp@fedoraproject.org> Link: https://lore.kernel.org/r/20250801170212.54409-2-berrange@redhat.com Signed-off-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'migration/qemu-file.c')
| -rw-r--r-- | migration/qemu-file.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 0ee0f48a3e..2d4ce174a5 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -348,17 +348,13 @@ static ssize_t coroutine_mixed_fn qemu_fill_buffer(QEMUFile *f) } else { qio_channel_wait(f->ioc, G_IO_IN); } - } else if (len < 0) { - len = -EIO; } } while (len == QIO_CHANNEL_ERR_BLOCK); if (len > 0) { f->buf_size += len; - } else if (len == 0) { - qemu_file_set_error_obj(f, -EIO, local_error); } else { - qemu_file_set_error_obj(f, len, local_error); + qemu_file_set_error_obj(f, -EIO, local_error); } for (int i = 0; i < nfd; i++) { |