summaryrefslogtreecommitdiff
path: root/src/test
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/test
parent911f8f0183ef723737de3661b1dd042c7b2fcb6e (diff)
downloadsystemd-0c2aedb451c9da0d997e46c84d399c80d7fcb61d.tar.gz
tree-wide: use FORK_REARRANGE_STDIO and FORK_CLOSE_ALL_FDS
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-execute.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/test/test-execute.c b/src/test/test-execute.c
index f6d05afc1b..7363ea95db 100644
--- a/src/test/test-execute.c
+++ b/src/test/test-execute.c
@@ -583,14 +583,12 @@ static int find_libraries(const char *exec, char ***ret) {
assert_se(pipe2(outpipe, O_NONBLOCK|O_CLOEXEC) == 0);
assert_se(pipe2(errpipe, O_NONBLOCK|O_CLOEXEC) == 0);
- r = safe_fork("(spawn-ldd)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG, &pid);
+ r = safe_fork_full("(spawn-ldd)",
+ (int[]) { -EBADF, outpipe[1], errpipe[1] },
+ NULL, 0,
+ FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_DEATHSIG|FORK_REARRANGE_STDIO|FORK_LOG, &pid);
assert_se(r >= 0);
if (r == 0) {
- if (rearrange_stdio(-EBADF, TAKE_FD(outpipe[1]), TAKE_FD(errpipe[1])) < 0)
- _exit(EXIT_FAILURE);
-
- (void) close_all_fds(NULL, 0);
-
execlp("ldd", "ldd", exec, NULL);
_exit(EXIT_FAILURE);
}