aboutsummaryrefslogtreecommitdiff
path: root/src/lib/process/process_unix.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2024-12-03 10:16:26 -0500
committerDavid Goulet <dgoulet@torproject.org>2024-12-03 10:16:32 -0500
commit717b59ac2be260b1ed7db0db32ca9b99dad6ff87 (patch)
treeb1b6ee5a0a09a5ef881a976bbe960fdfb846448f /src/lib/process/process_unix.c
parente5b51eb10f6802ea4cff9fab6d0b91e905630d15 (diff)
downloadtor-717b59ac2be260b1ed7db0db32ca9b99dad6ff87.tar.gz
tor-717b59ac2be260b1ed7db0db32ca9b99dad6ff87.zip
process: Don't close all FDs on new spawn
Fixes #40990 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/lib/process/process_unix.c')
-rw-r--r--src/lib/process/process_unix.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/lib/process/process_unix.c b/src/lib/process/process_unix.c
index 15ae03eadf..932cdf2e8c 100644
--- a/src/lib/process/process_unix.c
+++ b/src/lib/process/process_unix.c
@@ -137,7 +137,7 @@ process_unix_exec(process_t *process)
int stdin_pipe[2];
int stdout_pipe[2];
int stderr_pipe[2];
- int retval, fd;
+ int retval;
unix_process = process_get_unix_process(process);
@@ -240,11 +240,9 @@ process_unix_exec(process_t *process)
close(stdin_pipe[0]);
close(stdin_pipe[1]);
- /* Close all other fds, including the read end of the pipe. XXX: We should
- * now be doing enough FD_CLOEXEC setting to make this needless.
- */
- for (fd = STDERR_FILENO + 1; fd < max_fd; fd++)
- close(fd);
+ /* Note that we don't close all FDs from here, which we used to do, because
+ * all our open are CLOEXEC. With a very large maximum number of FDs, the
+ * loop was taking a long time: #40990 */
/* Create the argv value for our new process. */
char **argv = process_get_argv(process);