mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-23 06:35:28 +01:00
process: Don't close all FDs on new spawn
Fixes #40990 Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
e5b51eb10f
commit
717b59ac2b
2 changed files with 8 additions and 6 deletions
4
changes/ticket40990
Normal file
4
changes/ticket40990
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
o Minor bugfix (process):
|
||||||
|
- Avoid closing all possible FDs when spawning a process (PT). On some systems, this could
|
||||||
|
lead to 3+ minutes hang. Fixes bug 40990; bugfix on 0.3.5.1-alpha.
|
||||||
|
|
|
@ -137,7 +137,7 @@ process_unix_exec(process_t *process)
|
||||||
int stdin_pipe[2];
|
int stdin_pipe[2];
|
||||||
int stdout_pipe[2];
|
int stdout_pipe[2];
|
||||||
int stderr_pipe[2];
|
int stderr_pipe[2];
|
||||||
int retval, fd;
|
int retval;
|
||||||
|
|
||||||
unix_process = process_get_unix_process(process);
|
unix_process = process_get_unix_process(process);
|
||||||
|
|
||||||
|
@ -240,11 +240,9 @@ process_unix_exec(process_t *process)
|
||||||
close(stdin_pipe[0]);
|
close(stdin_pipe[0]);
|
||||||
close(stdin_pipe[1]);
|
close(stdin_pipe[1]);
|
||||||
|
|
||||||
/* Close all other fds, including the read end of the pipe. XXX: We should
|
/* Note that we don't close all FDs from here, which we used to do, because
|
||||||
* now be doing enough FD_CLOEXEC setting to make this needless.
|
* all our open are CLOEXEC. With a very large maximum number of FDs, the
|
||||||
*/
|
* loop was taking a long time: #40990 */
|
||||||
for (fd = STDERR_FILENO + 1; fd < max_fd; fd++)
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
/* Create the argv value for our new process. */
|
/* Create the argv value for our new process. */
|
||||||
char **argv = process_get_argv(process);
|
char **argv = process_get_argv(process);
|
||||||
|
|
Loading…
Add table
Reference in a new issue