summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2016-07-05 15:12:06 +0200
committerGitHub <noreply@github.com>2016-07-05 15:12:06 +0200
commit0df286596d538fc9a22ca5dc2ec835205c055c26 (patch)
tree945c4829de2e5faa14805c75d7bc9d7d40422457
parentc383be3b0fc99bbde492d6fe70ab38d8e23829f8 (diff)
parent9dfd9d14120c7beaa2369a70ea77bb28aeb4ea07 (diff)
downloadredis-0df286596d538fc9a22ca5dc2ec835205c055c26.tar.gz
Merge pull request #3365 from sskorgal/unstable
Fix for redis_cli printing default DB when select command fails. #3361
-rw-r--r--src/redis-cli.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c
index 17fb53394..070388380 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -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) {