summaryrefslogtreecommitdiff
path: root/src/home/homed-home.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-02-07 18:55:39 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-02-21 07:39:18 +0900
commit0c2aedb451c9da0d997e46c84d399c80d7fcb61d (patch)
tree594f8797a9bf7786406c3c0af349a8c6dca4f333 /src/home/homed-home.c
parent911f8f0183ef723737de3661b1dd042c7b2fcb6e (diff)
downloadsystemd-0c2aedb451c9da0d997e46c84d399c80d7fcb61d.tar.gz
tree-wide: use FORK_REARRANGE_STDIO and FORK_CLOSE_ALL_FDS
Diffstat (limited to 'src/home/homed-home.c')
-rw-r--r--src/home/homed-home.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/home/homed-home.c b/src/home/homed-home.c
index 8b4a81d7e8..413fcf1773 100644
--- a/src/home/homed-home.c
+++ b/src/home/homed-home.c
@@ -1180,9 +1180,9 @@ static int home_start_work(Home *h, const char *verb, UserRecord *hr, UserRecord
return -errno;
r = safe_fork_full("(sd-homework)",
- NULL,
- (int[]) { stdin_fd, stdout_fd }, 2,
- FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_DEATHSIG|FORK_LOG|FORK_REOPEN_LOG, &pid);
+ (int[]) { stdin_fd, stdout_fd, STDERR_FILENO },
+ NULL, 0,
+ FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_DEATHSIG|FORK_REARRANGE_STDIO|FORK_LOG|FORK_REOPEN_LOG, &pid);
if (r < 0)
return r;
if (r == 0) {
@@ -1227,13 +1227,6 @@ static int home_start_work(Home *h, const char *verb, UserRecord *hr, UserRecord
if (r < 0)
log_warning_errno(r, "Failed to update $SYSTEMD_EXEC_PID, ignoring: %m");
- r = rearrange_stdio(TAKE_FD(stdin_fd), TAKE_FD(stdout_fd), STDERR_FILENO); /* fds are invalidated by rearrange_stdio() even on failure */
- if (r < 0) {
- log_error_errno(r, "Failed to rearrange stdin/stdout/stderr: %m");
- _exit(EXIT_FAILURE);
- }
-
-
/* Allow overriding the homework path via an environment variable, to make debugging
* easier. */
homework = getenv("SYSTEMD_HOMEWORK_PATH") ?: SYSTEMD_HOMEWORK_PATH;