浏览代码

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 3 年之前
父节点
当前提交
3338a41f24
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      os-posix.c

+ 1 - 2
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();