os-posix: replace pipe()+cloexec with g_unix_open_pipe(CLOEXEC)

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
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-04-22 14:47:59 +04:00
parent 89810e10ed
commit 3338a41f24
1 changed files with 1 additions and 2 deletions

View File

@ -215,7 +215,7 @@ void os_daemonize(void)
pid_t pid;
int fds[2];
if (pipe(fds) == -1) {
if (!g_unix_open_pipe(fds, FD_CLOEXEC, NULL)) {
exit(1);
}
@ -240,7 +240,6 @@ void os_daemonize(void)
close(fds[0]);
daemon_pipe = fds[1];
qemu_set_cloexec(daemon_pipe);
setsid();