From a1a07225b3963eb251b518737a3f6b59515faaa1 Mon Sep 17 00:00:00 2001 From: oranagra Date: Thu, 10 Nov 2016 16:59:52 +0200 Subject: [PATCH] fix unsigned int overflow in adjustOpenFilesLimit --- src/server.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server.c b/src/server.c index 7e9b962b3..ed6d7d683 100644 --- a/src/server.c +++ b/src/server.c @@ -1570,9 +1570,9 @@ void adjustOpenFilesLimit(void) { if (bestlimit < oldlimit) bestlimit = oldlimit; if (bestlimit < maxfiles) { - int old_maxclients = server.maxclients; - server.maxclients = bestlimit-CONFIG_MIN_RESERVED_FDS; - if (server.maxclients < 1) { + unsigned int old_maxclients = server.maxclients; + server.maxclients = bestlimit-CONFIG_MIN_RESERVED_FDS; /* NOTICE: server.maxclients is unsigned */ + if (bestlimit <= CONFIG_MIN_RESERVED_FDS) { serverLog(LL_WARNING,"Your current 'ulimit -n' " "of %llu is not enough for the server to start. " "Please increase your open file limit to at least "