Permalink
Browse files

Restore argc/argv in EXEC after command is executed

  • Loading branch information...
1 parent 595b597 commit 61e254767591198d0cc191c043509d5b573cd526 @pietern pietern committed Feb 23, 2011
Showing with 11 additions and 0 deletions.
  1. +4 −0 src/multi.c
  2. +7 −0 tests/unit/other.tcl
View
@@ -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
@@ -174,6 +174,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

0 comments on commit 61e2547

Please sign in to comment.