Project

General

Profile

Bug #2723

setrlimit can increase RLIMIT_NOFILE up to rlim_max for non-root

Added by gstrauss over 1 year ago. Updated over 1 year ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
core
Target version:
Start date:
2016-04-05
Due date:
% Done:

0%

Estimated time:
Missing in 1.5.x:

Description

setrlimit can increase RLIMIT_NOFILE up to rlim_max for non-root

diff --git a/src/server.c b/src/server.c
index 61d850c..7aacf2e 100644
--- a/src/server.c
+++ b/src/server.c
@@ -954,9 +954,9 @@ int main (int argc, char **argv) {
                }

                /**
-                * we are not root can can't increase the fd-limit, but we can reduce it
+                * we are not root can can't increase the fd-limit above rlim_max, but we can reduce it
                 */
-               if (srv->srvconf.max_fds && srv->srvconf.max_fds < rlim.rlim_cur) {
+               if (srv->srvconf.max_fds && srv->srvconf.max_fds <= rlim.rlim_max) {
                        /* set rlimits */

                        rlim.rlim_cur = srv->srvconf.max_fds;

Associated revisions

Revision bb953177 (diff)
Added by gstrauss over 1 year ago

[core] setrlimit max-fds <= rlim_max for non-root (fixes #2723)

x-ref:
"setrlimit can increase RLIMIT_NOFILE up to rlim_max for non-root"
https://redmine.lighttpd.net/issues/2723

History

#1

Updated by gstrauss over 1 year ago

  • Category set to core
#2

Updated by gstrauss over 1 year ago

  • Status changed from Patch Pending to Fixed

committed in bb953177

Also available in: Atom