From 9fce3c6ca66bf0c4a532fb19aa2839a777d2297b Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 18 Apr 2020 18:07:52 -0700 Subject: [PATCH] ircd::fs: Condition to skip setrlimit(2) and infolog message. --- ircd/fs.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ircd/fs.cc b/ircd/fs.cc index 1cb4ff844..4e4ef10bd 100644 --- a/ircd/fs.cc +++ b/ircd/fs.cc @@ -101,9 +101,13 @@ try { rlimit rlim[2] {0}; syscall(getrlimit, RLIMIT_NOFILE, &rlim[0]); + rlim[1] = rlim[0]; rlim[1].rlim_cur = std::max(rlim[1].rlim_cur, ulong(fs::rlimit_nofile)); rlim[1].rlim_cur = std::min(rlim[1].rlim_cur, rlim[1].rlim_max); + if(rlim[0].rlim_cur == rlim[1].rlim_cur) + return; + syscall(setrlimit, RLIMIT_NOFILE, &rlim[1]); log::info {