Use g_unix_set_fd_nonblocking()

API available since glib 2.30. It also preserves errno.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Marc-André Lureau 2022-03-29 15:25:05 +04:00
parent c6d3bcb4b9
commit 4d14cb0cd7
3 changed files with 4 additions and 6 deletions

View file

@ -52,13 +52,11 @@ int event_notifier_init(EventNotifier *e, int active)
if (qemu_pipe(fds) < 0) {
return -errno;
}
ret = fcntl_setfl(fds[0], O_NONBLOCK);
if (ret < 0) {
if (!g_unix_set_fd_nonblocking(fds[0], true, NULL)) {
ret = -errno;
goto fail;
}
ret = fcntl_setfl(fds[1], O_NONBLOCK);
if (ret < 0) {
if (!g_unix_set_fd_nonblocking(fds[1], true, NULL)) {
ret = -errno;
goto fail;
}