summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ponymap.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ponymap.c b/ponymap.c
index 0941179..f620deb 100644
--- a/ponymap.c
+++ b/ponymap.c
@@ -25,6 +25,7 @@
#include <dirent.h>
#include <dlfcn.h>
#include <arpa/inet.h>
+#include <sys/resource.h>
#include <curses.h>
#include <term.h>
@@ -1894,6 +1895,17 @@ main (int argc, char *argv[])
setup_signal_handlers ();
+ // Set the maximum count of file descriptorts to the hard limit
+ struct rlimit limit;
+ if (getrlimit (RLIMIT_NOFILE, &limit))
+ print_warning ("%s: %s", "getrlimit failed", strerror (errno));
+ else
+ {
+ limit.rlim_cur = limit.rlim_max;
+ if (setrlimit (RLIMIT_NOFILE, &limit))
+ print_warning ("%s: %s", "setrlimit failed", strerror (errno));
+ }
+
init_terminal ();
atexit (free_terminal);