From 14ee3418e57ae7cb0c5d21aba23789189155a647 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 5 Jul 2016 15:18:40 +0200 Subject: [PATCH] redis-cli: check SELECT reply type just in state updated. In issues #3361 / #3365 a problem was reported / fixed with redis-cli not updating correctly the current DB on error after SELECT. In theory this bug was fixed in 0042fb0e, but actually the commit only fixed the prompt updating, not the fact the state was set in a wrong way. This commit removes the check in the prompt update, now that hopefully it is the state that is correct, there is no longer need for this check. --- src/redis-cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/redis-cli.c b/src/redis-cli.c index 070388380..6aacecc77 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -161,7 +161,7 @@ static void cliRefreshPrompt(void) { len = anetFormatAddr(config.prompt, sizeof(config.prompt), config.hostip, config.hostport); /* Add [dbnum] if needed */ - if (config.dbnum != 0 && config.last_cmd_type != REDIS_REPLY_ERROR) + if (config.dbnum != 0) len += snprintf(config.prompt+len,sizeof(config.prompt)-len,"[%d]", config.dbnum); snprintf(config.prompt+len,sizeof(config.prompt)-len,"> ");