Fix for redis_cli printing default DB when select command fails.

This commit is contained in:
sskorgal 2016-07-01 10:42:22 +05:30 committed by GitHub
parent 24bd9b19f6
commit 9dfd9d1412

View File

@ -916,7 +916,7 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
return REDIS_ERR; return REDIS_ERR;
} else { } else {
/* Store database number when SELECT was successfully executed. */ /* Store database number when SELECT was successfully executed. */
if (!strcasecmp(command,"select") && argc == 2) { if (!strcasecmp(command,"select") && argc == 2 && config.last_cmd_type != REDIS_REPLY_ERROR) {
config.dbnum = atoi(argv[1]); config.dbnum = atoi(argv[1]);
cliRefreshPrompt(); cliRefreshPrompt();
} else if (!strcasecmp(command,"auth") && argc == 2) { } else if (!strcasecmp(command,"auth") && argc == 2) {