[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
This commit is contained in:
Glenn Strauss 2016-04-13 02:39:14 -04:00
parent 51e0f2087b
commit bb95317774
2 changed files with 3 additions and 2 deletions

1
NEWS
View File

@ -73,6 +73,7 @@ NEWS
* [mod_status] table w/ count of con states (fixes #2427)
* [mod_dirlisting] class for dir <tr> (fixes #2304)
* [core] define __STDC_WANT_LIB_EXT1__ (fixes #2722)
* [core] setrlimit max-fds <= rlim_max for non-root (fixes #2723)
- 1.4.39 - 2016-01-02
* [core] fix memset_s call (fixes #2698)

View File

@ -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;