Unverified Commit c0725abf authored by Phoeniwx's avatar Phoeniwx Committed by GitHub
Browse files

fix: redis-cli --memkeys-samples add check lastarg (#11269)

doing redis-cli --memkeys-samples without any additional arguments
would have lead to a crash of the cli.
parent bd40d315
...@@ -2061,7 +2061,7 @@ static int parseOptions(int argc, char **argv) { ...@@ -2061,7 +2061,7 @@ static int parseOptions(int argc, char **argv) {
} else if (!strcmp(argv[i],"--memkeys")) { } else if (!strcmp(argv[i],"--memkeys")) {
config.memkeys = 1; config.memkeys = 1;
config.memkeys_samples = 0; /* use redis default */ config.memkeys_samples = 0; /* use redis default */
} else if (!strcmp(argv[i],"--memkeys-samples")) { } else if (!strcmp(argv[i],"--memkeys-samples") && !lastarg) {
config.memkeys = 1; config.memkeys = 1;
config.memkeys_samples = atoi(argv[++i]); config.memkeys_samples = atoi(argv[++i]);
} else if (!strcmp(argv[i],"--hotkeys")) { } else if (!strcmp(argv[i],"--hotkeys")) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment