提交 386a4694 编写于 作者: M Matt Stancliff

Fix potentially incorrect errno usage

errno may be reset by the previous call to redisLog, so capture
the original value for proper error reporting.
上级 3b54ee6e
......@@ -1534,6 +1534,7 @@ void adjustOpenFilesLimit(void) {
if (f < oldlimit) f = oldlimit;
if (f != maxfiles) {
int old_maxclients = server.maxclients;
int original_errno = errno;
server.maxclients = f-REDIS_MIN_RESERVED_FDS;
if (server.maxclients < 1) {
redisLog(REDIS_WARNING,"Your current 'ulimit -n' "
......@@ -1547,7 +1548,7 @@ void adjustOpenFilesLimit(void) {
old_maxclients, maxfiles);
redisLog(REDIS_WARNING,"Redis can't set maximum open files "
"to %llu because of OS error: %s.",
maxfiles, strerror(errno));
maxfiles, strerror(original_errno));
redisLog(REDIS_WARNING,"Current maximum open files is %llu. "
"maxclients has been reduced to %d to compensate for "
"low ulimit. "
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册