* automatically deduce ulimit-n from maxsock
diff --git a/haproxy.c b/haproxy.c
index dd349e1..3bab3f9 100644
--- a/haproxy.c
+++ b/haproxy.c
@@ -8206,6 +8206,9 @@
     }
 
     /* ulimits */
+    if (!global.rlimit_nofile)
+	global.rlimit_nofile = global.maxsock;
+
     if (global.rlimit_nofile) {
 	limit.rlim_cur = limit.rlim_max = global.rlimit_nofile;
 	if (setrlimit(RLIMIT_NOFILE, &limit) == -1) {