mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Make _SC_OPEN_MAX actually get used when closing fds before exec.
Fixes bug 8209; bugfix on 0.2.3.1-alpha.
This commit is contained in:
+3
-2
@@ -3834,12 +3834,13 @@ tor_spawn_background(const char *const filename, const char **argv,
|
||||
child_state = CHILD_STATE_MAXFD;
|
||||
|
||||
#ifdef _SC_OPEN_MAX
|
||||
if (-1 != max_fd) {
|
||||
if (-1 == max_fd) {
|
||||
max_fd = (int) sysconf(_SC_OPEN_MAX);
|
||||
if (max_fd == -1)
|
||||
if (max_fd == -1) {
|
||||
max_fd = DEFAULT_MAX_FD;
|
||||
log_warn(LD_GENERAL,
|
||||
"Cannot find maximum file descriptor, assuming %d", max_fd);
|
||||
}
|
||||
}
|
||||
#else
|
||||
max_fd = DEFAULT_MAX_FD;
|
||||
|
||||
Reference in New Issue
Block a user