summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsskorgal <santosh.korgal@huawei.com>2016-07-01 10:42:22 +0530
committerGitHub <noreply@github.com>2016-07-01 10:42:22 +0530
commit9dfd9d14120c7beaa2369a70ea77bb28aeb4ea07 (patch)
treed31dd8904d6011aa154af9aaf7b75fae7fcce062
parent24bd9b19f60712f635ce512a7fa29d6de2d98e39 (diff)
downloadredis-9dfd9d14120c7beaa2369a70ea77bb28aeb4ea07.tar.gz
Fix for redis_cli printing default DB when select command fails.
-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) {