Restore argc/argv in EXEC after command is executed

This commit is contained in:
Pieter Noordhuis 2011-02-23 09:39:29 +01:00 committed by antirez
parent bf45f266b3
commit 6c682e559c
2 changed files with 11 additions and 0 deletions

View File

@ -110,6 +110,10 @@ void execCommand(redisClient *c) {
c->argc = c->mstate.commands[j].argc;
c->argv = c->mstate.commands[j].argv;
call(c,c->mstate.commands[j].cmd);
/* Commands may alter argc/argv, restore mstate. */
c->mstate.commands[j].argc = c->argc;
c->mstate.commands[j].argv = c->argv;
}
c->argv = orig_argv;
c->argc = orig_argc;

View File

@ -183,6 +183,13 @@ start_server {tags {"other"}} {
set _ $err
} {*ERR MULTI*}
test {MULTI where commands alter argc/argv} {
r sadd myset a
r multi
r spop myset
list [r exec] [r exists myset]
} {a 0}
test {WATCH inside MULTI is not allowed} {
set err {}
r multi