Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
affd9365
Commit
affd9365
authored
Jul 18, 2018
by
zhaozhao.zz
Committed by
antirez
Oct 09, 2018
Browse files
Streams: XTRIM will return an error if MAXLEN with a count < 0
parent
4c405ad0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/t_stream.c
View file @
affd9365
...
...
@@ -2197,7 +2197,7 @@ void xtrimCommand(client *c) {
/* Argument parsing. */
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
the maxium length is not applied verbatim. */
...
...
@@ -2216,6 +2216,11 @@ void xtrimCommand(client *c) {
}
if
(
getLongLongFromObjectOrReply
(
c
,
c
->
argv
[
i
+
1
],
&
maxlen
,
NULL
)
!=
C_OK
)
return
;
if
(
maxlen
<
0
)
{
addReplyError
(
c
,
"The MAXLEN argument must be >= 0."
);
return
;
}
i
++
;
}
else
{
addReply
(
c
,
shared
.
syntaxerr
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment