aboutsummaryrefslogtreecommitdiffstats
path: root/nnn.c
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2017-07-25 10:13:22 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2017-07-25 10:13:22 +0530
commit16f0054b48634907dc4962ecd905cb61d7dab6e8 (patch)
treeb54e4f8be29cb26adc6a9f28d5b4f224a0e48c97 /nnn.c
parent75e3118acfbc253c2358bf3ee2ada70ed65018d3 (diff)
downloadnnn-16f0054b48634907dc4962ecd905cb61d7dab6e8.tar.gz
Fix #34: use ~75% of max open file descs
Diffstat (limited to 'nnn.c')
-rw-r--r--nnn.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/nnn.c b/nnn.c
index b48effb..a0f5c3a 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;
}