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

This commit is contained in:
Lennart Poettering
2018-03-02 11:42:10 +01:00
parent 8bb2db738e
commit 2b33ab0957
11 changed files with 39 additions and 169 deletions
+2 -7
View File
@@ -199,15 +199,10 @@ static int exec_process(const char* name, char **argv, char **env, int start_fd,
if (arg_inetd) {
assert(n_fds == 1);
r = dup2(start_fd, STDIN_FILENO);
r = rearrange_stdio(start_fd, start_fd, STDERR_FILENO); /* invalidates start_fd on success + error */
if (r < 0)
return log_error_errno(errno, "Failed to dup connection to stdin: %m");
return log_error_errno(errno, "Failed to move fd to stdin+stdout: %m");
r = dup2(start_fd, STDOUT_FILENO);
if (r < 0)
return log_error_errno(errno, "Failed to dup connection to stdout: %m");
start_fd = safe_close(start_fd);
} else {
if (start_fd != SD_LISTEN_FDS_START) {
assert(n_fds == 1);