tree-wide: port various places over to use new rearrange_stdio()

This commit is contained in:
Lennart Poettering
2018-02-28 23:32:49 +01:00
parent 8bb2db738e
commit 2b33ab0957
11 changed files with 39 additions and 169 deletions

View File

@@ -62,12 +62,9 @@ static int do_spawn(const char *path, char *argv[], int stdout_fd, pid_t *pid) {
char *_argv[2];
if (stdout_fd >= 0) {
/* If the fd happens to be in the right place, go along with that */
if (stdout_fd != STDOUT_FILENO &&
dup2(stdout_fd, STDOUT_FILENO) < 0)
r = rearrange_stdio(STDIN_FILENO, stdout_fd, STDERR_FILENO);
if (r < 0)
_exit(EXIT_FAILURE);
(void) fd_cloexec(STDOUT_FILENO, false);
}
if (!argv) {