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.
This commit is contained in:
antirez 2016-07-05 15:18:40 +02:00
parent 0df286596d
commit ef6a4df29c

View File

@ -161,7 +161,7 @@ static void cliRefreshPrompt(void) {
len = anetFormatAddr(config.prompt, sizeof(config.prompt), len = anetFormatAddr(config.prompt, sizeof(config.prompt),
config.hostip, config.hostport); config.hostip, config.hostport);
/* Add [dbnum] if needed */ /* 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]", len += snprintf(config.prompt+len,sizeof(config.prompt)-len,"[%d]",
config.dbnum); config.dbnum);
snprintf(config.prompt+len,sizeof(config.prompt)-len,"> "); snprintf(config.prompt+len,sizeof(config.prompt)-len,"> ");