From ef6a4df29c17e3c79a1e9b328fe3e2d1f2a9df39 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 07038838..6aacecc7 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,"> ");