mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 13:45:04 +02:00
Make sure Application::InitializeBase() when RLIMIT_NOFILE is set to "unlimited".
Refs #6257
This commit is contained in:
parent
d66b4d587e
commit
f9512dd495
@ -110,11 +110,17 @@ void Application::InitializeBase(void)
|
|||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
rlimit rl;
|
rlimit rl;
|
||||||
if (getrlimit(RLIMIT_NOFILE, &rl) >= 0)
|
if (getrlimit(RLIMIT_NOFILE, &rl) >= 0) {
|
||||||
for (rlim_t i = 3; i < rl.rlim_max; i++) {
|
rlim_t maxfds = rl.rlim_max;
|
||||||
|
|
||||||
|
if (maxfds == RLIM_INFINITY)
|
||||||
|
maxfds = 65536;
|
||||||
|
|
||||||
|
for (rlim_t i = 3; i < maxfds; i++) {
|
||||||
if (close(i) >= 0)
|
if (close(i) >= 0)
|
||||||
std::cerr << "Closed FD " << i << " which we inherited from our parent process." << std::endl;
|
std::cerr << "Closed FD " << i << " which we inherited from our parent process." << std::endl;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
Utility::ExecuteDeferredInitializers();
|
Utility::ExecuteDeferredInitializers();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user