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>
This commit is contained in:
Marc-André Lureau 2022-04-22 14:51:47 +04:00
parent bd2142c353
commit d640b59eb3
1 changed files with 2 additions and 2 deletions

View File

@ -76,8 +76,8 @@ qio_channel_command_new_spawn(const char *const argv[],
} }
} }
if ((!stdinnull && pipe(stdinfd) < 0) || if ((!stdinnull && !g_unix_open_pipe(stdinfd, FD_CLOEXEC, NULL)) ||
(!stdoutnull && pipe(stdoutfd) < 0)) { (!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;