mirror of
https://github.com/fluencelabs/redis
synced 2025-04-01 15:21:03 +00:00
Fix potentially incorrect errno usage
errno may be reset by the previous call to redisLog, so capture the original value for proper error reporting.
This commit is contained in:
parent
3b54ee6ea4
commit
386a46946b
@ -1534,6 +1534,7 @@ void adjustOpenFilesLimit(void) {
|
|||||||
if (f < oldlimit) f = oldlimit;
|
if (f < oldlimit) f = oldlimit;
|
||||||
if (f != maxfiles) {
|
if (f != maxfiles) {
|
||||||
int old_maxclients = server.maxclients;
|
int old_maxclients = server.maxclients;
|
||||||
|
int original_errno = errno;
|
||||||
server.maxclients = f-REDIS_MIN_RESERVED_FDS;
|
server.maxclients = f-REDIS_MIN_RESERVED_FDS;
|
||||||
if (server.maxclients < 1) {
|
if (server.maxclients < 1) {
|
||||||
redisLog(REDIS_WARNING,"Your current 'ulimit -n' "
|
redisLog(REDIS_WARNING,"Your current 'ulimit -n' "
|
||||||
@ -1547,7 +1548,7 @@ void adjustOpenFilesLimit(void) {
|
|||||||
old_maxclients, maxfiles);
|
old_maxclients, maxfiles);
|
||||||
redisLog(REDIS_WARNING,"Redis can't set maximum open files "
|
redisLog(REDIS_WARNING,"Redis can't set maximum open files "
|
||||||
"to %llu because of OS error: %s.",
|
"to %llu because of OS error: %s.",
|
||||||
maxfiles, strerror(errno));
|
maxfiles, strerror(original_errno));
|
||||||
redisLog(REDIS_WARNING,"Current maximum open files is %llu. "
|
redisLog(REDIS_WARNING,"Current maximum open files is %llu. "
|
||||||
"maxclients has been reduced to %d to compensate for "
|
"maxclients has been reduced to %d to compensate for "
|
||||||
"low ulimit. "
|
"low ulimit. "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user