diff options
author | zhaozhao.zz <zhaozhao.zz@alibaba-inc.com> | 2018-09-28 12:06:43 +0800 |
---|---|---|
committer | zhaozhao.zz <zhaozhao.zz@alibaba-inc.com> | 2018-09-28 12:06:48 +0800 |
commit | fc9b4e79589c049276ff4c7cf536b49d700f8cee (patch) | |
tree | fb7ffb499e1037d9866f1d3c722873066f07f25b /src/t_list.c | |
parent | 0d6f11f4d1748d0e8b35032338a1f4d927838a49 (diff) | |
download | redis-fc9b4e79589c049276ff4c7cf536b49d700f8cee.tar.gz |
bugfix: replace lastcmd with cmd when rewrite BRPOPLPUSH as RPOPLPUSH
There are two problems if we use lastcmd:
1. BRPOPLPUSH cannot be rewrited as RPOPLPUSH in multi/exec
In mulit/exec context, the lastcmd is exec.
2. Redis will crash when execute RPOPLPUSH loading from AOF
In fakeClient, the lastcmd is NULL.
Diffstat (limited to 'src/t_list.c')
-rw-r--r-- | src/t_list.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/t_list.c b/src/t_list.c index 987392e6e..c8f4703d5 100644 --- a/src/t_list.c +++ b/src/t_list.c @@ -596,7 +596,7 @@ void rpoplpushCommand(client *c) { signalModifiedKey(c->db,touchedkey); decrRefCount(touchedkey); server.dirty++; - if (c->lastcmd->proc == brpoplpushCommand) { + if (c->cmd->proc == brpoplpushCommand) { rewriteClientCommandVector(c,3,shared.rpoplpush,c->argv[1],c->argv[2]); } } |