Browse Source

io: replace pipe() 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: Daniel P. Berrangé <berrange@redhat.com>
Marc-André Lureau 3 years ago
parent
commit
d640b59eb3
1 changed files with 2 additions and 2 deletions
  1. 2 2
      io/channel-command.c

+ 2 - 2
io/channel-command.c

@@ -76,8 +76,8 @@ qio_channel_command_new_spawn(const char *const argv[],
         }
         }
     }
     }
 
 
-    if ((!stdinnull && pipe(stdinfd) < 0) ||
-        (!stdoutnull && pipe(stdoutfd) < 0)) {
+    if ((!stdinnull && !g_unix_open_pipe(stdinfd, FD_CLOEXEC, NULL)) ||
+        (!stdoutnull && !g_unix_open_pipe(stdoutfd, FD_CLOEXEC, NULL))) {
         error_setg_errno(errp, errno,
         error_setg_errno(errp, errno,
                          "Unable to open pipe");
                          "Unable to open pipe");
         goto error;
         goto error;