diff options
author | Johannes Truschnigg <5927519+jtru@users.noreply.github.com> | 2022-06-12 19:53:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-12 20:53:11 +0300 |
commit | 9f3b410050d998110ae91c2ac49f832ce0ba2629 (patch) | |
tree | c0e79fdcba897176aa9132e2513a894bfcb58b2b /src/syscheck.c | |
parent | abb2ea7e3caee9f41aeee2f955d00c905f9f2079 (diff) | |
download | redis-9f3b410050d998110ae91c2ac49f832ce0ba2629.tar.gz |
Correctly check for vm.overcommit_memory == 0 (#10841)
A regression caused by #10636 (released in 7.0.1) causes Redis startup warning about overcommit to be missing when needed and printed when not.
Also, using atoi() to convert the string's value to an integer cannot discern
between an actual 0 (zero) having been read, or a conversion error.
Diffstat (limited to 'src/syscheck.c')
-rw-r--r-- | src/syscheck.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/syscheck.c b/src/syscheck.c index 58dc78f1b..5f0b799e4 100644 --- a/src/syscheck.c +++ b/src/syscheck.c @@ -150,7 +150,7 @@ int checkOvercommit(sds *error_msg) { } fclose(fp); - if (atoi(buf)) { + if (strtol(buf, NULL, 10) == 0) { *error_msg = sdsnew( "overcommit_memory is set to 0! Background save may fail under low memory condition. " "To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the " |