summaryrefslogtreecommitdiffstats
path: root/os-posix.c
diff options
context:
space:
mode:
authorMarc-André Lureau2022-04-22 12:47:59 +0200
committerMarc-André Lureau2022-05-03 13:46:17 +0200
commit3338a41f24de3033ceb9ac047811826e64b360e6 (patch)
tree2e885023ab8586c832959412f43077feb0188c45 /os-posix.c
parenttests: replace pipe() with g_unix_open_pipe(CLOEXEC) (diff)
downloadqemu-3338a41f24de3033ceb9ac047811826e64b360e6.tar.gz
qemu-3338a41f24de3033ceb9ac047811826e64b360e6.tar.xz
qemu-3338a41f24de3033ceb9ac047811826e64b360e6.zip
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>
Diffstat (limited to 'os-posix.c')
-rw-r--r--os-posix.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/os-posix.c b/os-posix.c
index 1b746dba97..321fc4bd13 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -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();