os-posix: replace pipe()+cloexec with g_unix_open_pipe(CLOEXEC)
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Fri, 22 Apr 2022 10:47:59 +0000 (14:47 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 3 May 2022 11:46:17 +0000 (15:46 +0400)
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>
os-posix.c

index 1b746dba97a719e977a93a343dba89302d86f7d6..321fc4bd13b84e882a60bb8d9a839798b67a5da1 100644 (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();