From 16f0054b48634907dc4962ecd905cb61d7dab6e8 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Tue, 25 Jul 2017 10:13:22 +0530 Subject: [PATCH] Fix #34: use ~75% of max open file descs --- nnn.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/nnn.c b/nnn.c index b48effb91..a0f5c3aa6 100644 --- a/nnn.c +++ b/nnn.c @@ -245,11 +245,9 @@ max_openfds() limit = rl.rlim_cur; rl.rlim_cur = rl.rlim_max; + /* Return ~75% of max possible */ if (setrlimit(RLIMIT_NOFILE, &rl) == 0) - return rl.rlim_max - 64; - - if (limit > 128) - return limit - 64; + return (rl.rlim_max - (rl.rlim_max >> 2)); return 32; }