Unverified Commit 09b7f6c2 authored by Wen Hui's avatar Wen Hui Committed by GitHub
Browse files

use getPositiveLongFromObjectOrReply for positive check in spop (#8146)

This is a cleanup commit that doesn't fix any bug, however it does change the error response text in case the user provided a negative number.
parent 6bb55035
...@@ -457,13 +457,8 @@ void spopWithCountCommand(client *c) { ...@@ -457,13 +457,8 @@ void spopWithCountCommand(client *c) {
robj *set; robj *set;
/* Get the count argument */ /* Get the count argument */
if (getLongFromObjectOrReply(c,c->argv[2],&l,NULL) != C_OK) return; if (getPositiveLongFromObjectOrReply(c,c->argv[2],&l,NULL) != C_OK) return;
if (l >= 0) { count = (unsigned long) l;
count = (unsigned long) l;
} else {
addReply(c,shared.outofrangeerr);
return;
}
/* Make sure a key with the name inputted exists, and that it's type is /* Make sure a key with the name inputted exists, and that it's type is
* indeed a set. Otherwise, return nil */ * indeed a set. Otherwise, return nil */
......
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