summary refs log tree commit diff stats
path: root/chardev/char-stdio.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:51:52 +0400
commitb84bb4dfe5d03b40c91260db8ee07d65809fc35f (patch)
tree16e770c0a41aa2cd5a848572633b3b9f7a8d2359 /chardev/char-stdio.c
parent05e50e8fe5fed707653e1e5e2f2871f253a70452 (diff)
downloadfocaccia-qemu-b84bb4dfe5d03b40c91260db8ee07d65809fc35f.tar.gz
focaccia-qemu-b84bb4dfe5d03b40c91260db8ee07d65809fc35f.zip
chardev: replace qemu_set_nonblock()
Those calls are either for 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 'chardev/char-stdio.c')
-rw-r--r--chardev/char-stdio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/chardev/char-stdio.c b/chardev/char-stdio.c
index 403da308c9..3c648678ab 100644
--- a/chardev/char-stdio.c
+++ b/chardev/char-stdio.c
@@ -103,7 +103,10 @@ static void qemu_chr_open_stdio(Chardev *chr,
     stdio_in_use = true;
     old_fd0_flags = fcntl(0, F_GETFL);
     tcgetattr(0, &oldtty);
-    qemu_set_nonblock(0);
+    if (!g_unix_set_fd_nonblocking(0, true, NULL)) {
+        error_setg_errno(errp, errno, "Failed to set FD nonblocking");
+        return;
+    }
     atexit(term_exit);
 
     memset(&act, 0, sizeof(act));