Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
orbea
Tor
Commits
5dc785ce
Commit
5dc785ce
authored
7 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'public/bug21074_029' into maint-0.2.9
parents
320dac46
0bfd5a65
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changes/bug21074_downgrade
+4
-0
4 additions, 0 deletions
changes/bug21074_downgrade
src/common/compat.c
+7
-7
7 additions, 7 deletions
src/common/compat.c
with
11 additions
and
7 deletions
changes/bug21074_downgrade
0 → 100644
+
4
−
0
View file @
5dc785ce
o Minor bugfixes:
- Don't exit the Tor process if setrlimit() fails to change the file
limit (which can happen sometimes on some versions of OSX). Fixes
bug 21074; bugfix on 0.0.9pre5.
This diff is collapsed.
Click to expand it.
src/common/compat.c
+
7
−
7
View file @
5dc785ce
...
...
@@ -1651,7 +1651,7 @@ get_max_sockets(void)
* fail by returning -1 and <b>max_out</b> is untouched.
*
* If we are unable to set the limit value because of setrlimit() failing,
* return
-1
and <b>max_out</b> is set to the current maximum value returned
* return
0
and <b>max_out</b> is set to the current maximum value returned
* by getrlimit().
*
* Otherwise, return 0 and store the maximum we found inside <b>max_out</b>
...
...
@@ -1716,13 +1716,14 @@ set_max_file_descriptors(rlim_t limit, int *max_out)
rlim
.
rlim_cur
=
rlim
.
rlim_max
;
if
(
setrlimit
(
RLIMIT_NOFILE
,
&
rlim
)
!=
0
)
{
int
bad
=
1
;
int
couldnt_set
=
1
;
const
int
setrlimit_errno
=
errno
;
#ifdef OPEN_MAX
uint64_t
try_limit
=
OPEN_MAX
-
ULIMIT_BUFFER
;
if
(
errno
==
EINVAL
&&
try_limit
<
(
uint64_t
)
rlim
.
rlim_cur
)
{
/* On some platforms, OPEN_MAX is the real limit, and getrlimit() is
* full of nasty lies. I'm looking at you, OSX 10.5.... */
rlim
.
rlim_cur
=
try_limit
;
rlim
.
rlim_cur
=
MIN
((
rlim_t
)
try_limit
,
rlim
.
rlim_cur
)
;
if
(
setrlimit
(
RLIMIT_NOFILE
,
&
rlim
)
==
0
)
{
if
(
rlim
.
rlim_cur
<
(
rlim_t
)
limit
)
{
log_warn
(
LD_CONFIG
,
"We are limited to %lu file descriptors by "
...
...
@@ -1737,14 +1738,13 @@ set_max_file_descriptors(rlim_t limit, int *max_out)
(
unsigned
long
)
try_limit
,
(
unsigned
long
)
OPEN_MAX
,
(
unsigned
long
)
rlim
.
rlim_max
);
}
bad
=
0
;
couldnt_set
=
0
;
}
}
#endif
/* OPEN_MAX */
if
(
bad
)
{
if
(
couldnt_set
)
{
log_warn
(
LD_CONFIG
,
"Couldn't set maximum number of file descriptors: %s"
,
strerror
(
errno
));
return
-
1
;
strerror
(
setrlimit_errno
));
}
}
/* leave some overhead for logs, etc, */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment