aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor_bsd.cc
diff options
context:
space:
mode:
authorAnton Lindqvist <anton.lindqvist@gmail.com>2018-07-20 09:13:43 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-07-23 11:11:32 +0200
commite3c4ac00eec1fcc9ee04104185c152f429019a1c (patch)
tree2ee261ae76613f903c7a3ca531b94fe177655023 /executor/executor_bsd.cc
parent3f17ab418afb3ad0916103629e8b3a8ceeb6c451 (diff)
executor: ensure RLIMIT_NOFILE is greater than kInPipeFd
Diffstat (limited to 'executor/executor_bsd.cc')
-rw-r--r--executor/executor_bsd.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/executor/executor_bsd.cc b/executor/executor_bsd.cc
index e14d36109..f55dccd54 100644
--- a/executor/executor_bsd.cc
+++ b/executor/executor_bsd.cc
@@ -88,6 +88,12 @@ int main(int argc, char** argv)
rlim.rlim_cur = rlim.rlim_max = 0;
setrlimit(RLIMIT_CORE, &rlim);
+ const int nfiles = 1 << 8;
+ if (kInPipeFd >= nfiles)
+ fail("RLIMIT_NOFILE too low: %d > %d", kInPipeFd, nfiles);
+ rlim.rlim_cur = rlim.rlim_max = nfiles;
+ setrlimit(RLIMIT_NOFILE, &rlim);
+
install_segv_handler();
main_init();
reply_handshake();