On Wed, Sep 03, 2025 at 12:44:04PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> Use common qemu_set_blocking() instead.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
> ---
> contrib/ivshmem-server/ivshmem-server.c | 5 ++++-
> hw/hyperv/syndbg.c | 4 +++-
> hw/virtio/vhost-user.c | 5 ++++-
> include/qemu/sockets.h | 1 -
> io/channel-socket.c | 7 +++----
> net/dgram.c | 16 +++++++++++++---
> net/l2tpv3.c | 5 +++--
> net/socket.c | 20 ++++++++++++++++----
> qga/channel-posix.c | 7 ++++++-
> tests/unit/socket-helpers.c | 5 ++++-
> tests/unit/test-crypto-tlssession.c | 8 ++++----
> util/oslib-posix.c | 7 -------
> util/oslib-win32.c | 5 -----
> util/vhost-user-server.c | 4 ++--
> 14 files changed, 62 insertions(+), 37 deletions(-)
>
> diff --git a/qga/channel-posix.c b/qga/channel-posix.c
> index 465d688ecb..ddf8ebdc5e 100644
> --- a/qga/channel-posix.c
> +++ b/qga/channel-posix.c
> @@ -28,6 +28,7 @@ static gboolean ga_channel_listen_accept(GIOChannel
> *channel,
> GAChannel *c = data;
> int ret, client_fd;
> bool accepted = false;
> + Error *err = NULL;
>
> g_assert(channel != NULL);
>
> @@ -36,7 +37,11 @@ static gboolean ga_channel_listen_accept(GIOChannel
> *channel,
> g_warning("error converting fd to gsocket: %s", strerror(errno));
> goto out;
> }
> - qemu_socket_set_nonblock(client_fd);
> + if (!qemu_set_blocking(client_fd, false, &err)) {
> + g_warning("errer: %s", error_get_pretty(err));
s/errer/error/
This is a pre-existing problem, but none of this code should be using
g_warning. g_printerr() should have been used for printing error
messages. I'm not expecting you to fix that, just an observation.
> + error_free(err);
> + goto out;
> + }
> ret = ga_channel_client_add(c, client_fd);
> if (ret) {
> g_warning("error setting up connection");
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|