mirror of
https://github.com/fluencelabs/redis
synced 2025-03-26 04:11:04 +00:00
Streams: XTRIM will return an error if MAXLEN with a count < 0
This commit is contained in:
parent
20c6a7fe2c
commit
da6b7516f1
@ -2192,7 +2192,7 @@ void xtrimCommand(client *c) {
|
|||||||
|
|
||||||
/* Argument parsing. */
|
/* Argument parsing. */
|
||||||
int trim_strategy = TRIM_STRATEGY_NONE;
|
int trim_strategy = TRIM_STRATEGY_NONE;
|
||||||
long long maxlen = 0; /* 0 means no maximum length. */
|
long long maxlen = -1; /* If left to -1 no trimming is performed. */
|
||||||
int approx_maxlen = 0; /* If 1 only delete whole radix tree nodes, so
|
int approx_maxlen = 0; /* If 1 only delete whole radix tree nodes, so
|
||||||
the maxium length is not applied verbatim. */
|
the maxium length is not applied verbatim. */
|
||||||
|
|
||||||
@ -2211,6 +2211,11 @@ void xtrimCommand(client *c) {
|
|||||||
}
|
}
|
||||||
if (getLongLongFromObjectOrReply(c,c->argv[i+1],&maxlen,NULL)
|
if (getLongLongFromObjectOrReply(c,c->argv[i+1],&maxlen,NULL)
|
||||||
!= C_OK) return;
|
!= C_OK) return;
|
||||||
|
|
||||||
|
if (maxlen < 0) {
|
||||||
|
addReplyError(c,"The MAXLEN argument must be >= 0.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
} else {
|
} else {
|
||||||
addReply(c,shared.syntaxerr);
|
addReply(c,shared.syntaxerr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user