summary refs log tree commit diff stats
path: root/hw/input/virtio-input-host.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2022-04-25 17:39:06 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2022-05-03 15:52:33 +0400
commit701544cfaf46f24d912ad1714eb24641c3c96837 (patch)
treef9d4abe1e12411055c4039733aed41e70007a689 /hw/input/virtio-input-host.c
parentb0a8f9adfed871728154b0064a28e34b6670f9f2 (diff)
downloadfocaccia-qemu-701544cfaf46f24d912ad1714eb24641c3c96837.tar.gz
focaccia-qemu-701544cfaf46f24d912ad1714eb24641c3c96837.zip
hw: replace qemu_set_nonblock()
Those calls are non-socket fd, or are POSIX-specific. Use the dedicated
GLib API. (qemu_set_nonblock() is for socket-like)

(this is a preliminary patch before renaming qemu_set_nonblock())

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'hw/input/virtio-input-host.c')
-rw-r--r--hw/input/virtio-input-host.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/input/virtio-input-host.c b/hw/input/virtio-input-host.c
index 137efba57b..fea7139382 100644
--- a/hw/input/virtio-input-host.c
+++ b/hw/input/virtio-input-host.c
@@ -114,7 +114,10 @@ static void virtio_input_host_realize(DeviceState *dev, Error **errp)
         error_setg_file_open(errp, errno, vih->evdev);
         return;
     }
-    qemu_set_nonblock(vih->fd);
+    if (!g_unix_set_fd_nonblocking(vih->fd, true, NULL)) {
+        error_setg_errno(errp, errno, "Failed to set FD nonblocking");
+        goto err_close;
+    }
 
     rc = ioctl(vih->fd, EVIOCGVERSION, &ver);
     if (rc < 0) {