summaryrefslogtreecommitdiff
path: root/src/sysupdate
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/sysupdate
parent911f8f0183ef723737de3661b1dd042c7b2fcb6e (diff)
downloadsystemd-0c2aedb451c9da0d997e46c84d399c80d7fcb61d.tar.gz
tree-wide: use FORK_REARRANGE_STDIO and FORK_CLOSE_ALL_FDS
Diffstat (limited to 'src/sysupdate')
-rw-r--r--src/sysupdate/sysupdate-resource.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/sysupdate/sysupdate-resource.c b/src/sysupdate/sysupdate-resource.c
index e1e260addc..6c05d245f8 100644
--- a/src/sysupdate/sysupdate-resource.c
+++ b/src/sysupdate/sysupdate-resource.c
@@ -264,7 +264,11 @@ static int download_manifest(
log_info("%s Acquiring manifest file %s%s", special_glyph(SPECIAL_GLYPH_DOWNLOAD),
suffixed_url, special_glyph(SPECIAL_GLYPH_ELLIPSIS));
- r = safe_fork("(sd-pull)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG, &pid);
+ r = safe_fork_full("(sd-pull)",
+ (int[]) { -EBADF, pfd[1], STDERR_FILENO },
+ NULL, 0,
+ FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_DEATHSIG|FORK_REARRANGE_STDIO|FORK_LOG,
+ &pid);
if (r < 0)
return r;
if (r == 0) {
@@ -280,14 +284,6 @@ static int download_manifest(
NULL
};
- pfd[0] = safe_close(pfd[0]);
-
- r = rearrange_stdio(-EBADF, pfd[1], STDERR_FILENO);
- if (r < 0) {
- log_error_errno(r, "Failed to rearrange stdin/stdout: %m");
- _exit(EXIT_FAILURE);
- }
-
(void) unsetenv("NOTIFY_SOCKET");
execv(pull_binary_path(), (char *const*) cmdline);
log_error_errno(errno, "Failed to execute %s tool: %m", pull_binary_path());