qga: replace qemu_set_nonblock()

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 <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
master
Marc-André Lureau 2022-04-25 17:39:06 +04:00
parent 17fc124529
commit b0a8f9adfe
1 changed files with 5 additions and 1 deletions

View File

@ -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) {