Ver Fonte

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>
Marc-André Lureau há 3 anos atrás
pai
commit
3338a41f24
1 ficheiros alterados com 1 adições e 2 exclusões
  1. 1 2
      os-posix.c

+ 1 - 2
os-posix.c

@@ -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();