Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
d96f47cf
Unverified
Commit
d96f47cf
authored
Apr 07, 2021
by
Wen Hui
Committed by
GitHub
Apr 07, 2021
Browse files
use getPositiveLongFromObjectOrReply for positive check of args (#8750)
just a cleanup
parent
4c14e866
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/t_list.c
View file @
d96f47cf
...
...
@@ -592,20 +592,14 @@ void lposCommand(client *c) {
}
}
else
if
(
!
strcasecmp
(
opt
,
"COUNT"
)
&&
moreargs
)
{
j
++
;
if
(
getLongFromObjectOrReply
(
c
,
c
->
argv
[
j
],
&
count
,
NULL
)
!=
C_OK
)
if
(
getPositiveLongFromObjectOrReply
(
c
,
c
->
argv
[
j
],
&
count
,
"COUNT can't be negative"
)
!=
C_OK
)
return
;
if
(
count
<
0
)
{
addReplyError
(
c
,
"COUNT can't be negative"
);
return
;
}
}
else
if
(
!
strcasecmp
(
opt
,
"MAXLEN"
)
&&
moreargs
)
{
j
++
;
if
(
getLongFromObjectOrReply
(
c
,
c
->
argv
[
j
],
&
maxlen
,
NULL
)
!=
C_OK
)
if
(
getPositiveLongFromObjectOrReply
(
c
,
c
->
argv
[
j
],
&
maxlen
,
"MAXLEN can't be negative"
)
!=
C_OK
)
return
;
if
(
maxlen
<
0
)
{
addReplyError
(
c
,
"MAXLEN can't be negative"
);
return
;
}
}
else
{
addReplyErrorObject
(
c
,
shared
.
syntaxerr
);
return
;
...
...
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