mirror of
https://github.com/fluencelabs/redis
synced 2025-05-20 22:21:20 +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
771f8ad0e7
commit
c3510af1c0
@ -1461,6 +1461,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' "
|
||||||
@ -1474,7 +1475,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