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:
parent
89810e10ed
commit
3338a41f24
@ -215,7 +215,7 @@ void os_daemonize(void)
|
|||||||
pid_t pid;
|
pid_t pid;
|
||||||
int fds[2];
|
int fds[2];
|
||||||
|
|
||||||
if (pipe(fds) == -1) {
|
if (!g_unix_open_pipe(fds, FD_CLOEXEC, NULL)) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +240,6 @@ void os_daemonize(void)
|
|||||||
|
|
||||||
close(fds[0]);
|
close(fds[0]);
|
||||||
daemon_pipe = fds[1];
|
daemon_pipe = fds[1];
|
||||||
qemu_set_cloexec(daemon_pipe);
|
|
||||||
|
|
||||||
setsid();
|
setsid();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user