FIX: core dump in redis-benchmark when the -r is the last arg

This commit is contained in:
git-hulk 2019-04-23 20:08:14 +08:00
parent d044e33c20
commit fa97ef34ca

View File

@ -1294,7 +1294,7 @@ int parseOptions(int argc, const char **argv) {
if (*p < '0' || *p > '9') goto invalid; if (*p < '0' || *p > '9') goto invalid;
} }
config.randomkeys = 1; config.randomkeys = 1;
config.randomkeys_keyspacelen = atoi(argv[++i]); config.randomkeys_keyspacelen = atoi(next);
if (config.randomkeys_keyspacelen < 0) if (config.randomkeys_keyspacelen < 0)
config.randomkeys_keyspacelen = 0; config.randomkeys_keyspacelen = 0;
} else if (!strcmp(argv[i],"-q")) { } else if (!strcmp(argv[i],"-q")) {