Commit 9ddd0f77 authored by Gengliang Wang's avatar Gengliang Wang Committed by antirez
Browse files

Fix a bug in srandmemberWithCountCommand()

In CASE 2, the call sunionDiffGenericCommand will involve the string "srandmember"
> sadd foo one
(integer 1)
> sadd srandmember two
(integer 2)
> srandmember foo 3
1)"one"
2)"two"
parent c17a7f6f
...@@ -450,7 +450,7 @@ void srandmemberWithCountCommand(redisClient *c) { ...@@ -450,7 +450,7 @@ void srandmemberWithCountCommand(redisClient *c) {
* The number of requested elements is greater than the number of * The number of requested elements is greater than the number of
* elements inside the set: simply return the whole set. */ * elements inside the set: simply return the whole set. */
if (count >= size) { if (count >= size) {
sunionDiffGenericCommand(c,c->argv,c->argc-1,NULL,REDIS_OP_UNION); sunionDiffGenericCommand(c,c->argv+1,1,NULL,REDIS_OP_UNION);
return; return;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment