From: Marc-André Lureau Date: Fri, 22 Apr 2022 10:45:35 +0000 (+0400) Subject: util: replace pipe()+cloexec with g_unix_open_pipe() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=81badab381db30930f73f7fd16348f4df2ba7252;p=qemu.git util: replace pipe()+cloexec with g_unix_open_pipe() Suggested-by: Daniel P. Berrangé Signed-off-by: Marc-André Lureau Reviewed-by: Richard Henderson --- diff --git a/util/compatfd.c b/util/compatfd.c index 55b6e0b7fb..147e39e2c6 100644 --- a/util/compatfd.c +++ b/util/compatfd.c @@ -60,14 +60,11 @@ static int qemu_signalfd_compat(const sigset_t *mask) info = g_malloc(sizeof(*info)); - if (pipe(fds) == -1) { + if (!g_unix_open_pipe(fds, FD_CLOEXEC, NULL)) { g_free(info); return -1; } - qemu_set_cloexec(fds[0]); - qemu_set_cloexec(fds[1]); - memcpy(&info->mask, mask, sizeof(*mask)); info->fd = fds[1];