From 0c2aedb451c9da0d997e46c84d399c80d7fcb61d Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 7 Feb 2023 18:55:39 +0900 Subject: tree-wide: use FORK_REARRANGE_STDIO and FORK_CLOSE_ALL_FDS --- src/test/test-execute.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/test') 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); } -- cgit v1.2.1