Merge pull request #3365 from sskorgal/unstable

Fix for redis_cli printing default DB when select command fails. #3361
This commit is contained in:
Salvatore Sanfilippo 2016-07-05 15:12:06 +02:00 committed by GitHub
commit 0df286596d

View File

@ -916,7 +916,7 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
return REDIS_ERR;
} else {
/* 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]);
cliRefreshPrompt();
} else if (!strcasecmp(command,"auth") && argc == 2) {