From b0a8f9adfed871728154b0064a28e34b6670f9f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 25 Apr 2022 17:39:06 +0400 Subject: qga: replace qemu_set_nonblock() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The call is POSIX-specific. Use the dedicated GLib API. (this is a preliminary patch before renaming qemu_set_nonblock()) Signed-off-by: Marc-André Lureau Reviewed-by: Daniel P. Berrangé --- qga/commands-posix.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'qga/commands-posix.c') diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 094487c..78f2f21 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -404,7 +404,11 @@ int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, /* set fd non-blocking to avoid common use cases (like reading from a * named pipe) from hanging the agent */ - qemu_set_nonblock(fileno(fh)); + if (!g_unix_set_fd_nonblocking(fileno(fh), true, NULL)) { + fclose(fh); + error_setg_errno(errp, errno, "Failed to set FD nonblocking"); + return -1; + } handle = guest_file_handle_add(fh, errp); if (handle < 0) { -- cgit v1.1