Commit 78eaf503 authored by xhe's avatar xhe
Browse files

address comment


Signed-off-by: default avatarxhe <xw897002528@gmail.com>
parent f6711b7d
......@@ -2763,16 +2763,17 @@ void helloCommand(client *c) {
long long ver = 0;
int next_arg = 1;
if (c->argc >= 2 && getLongLongFromObject(c->argv[next_arg++],&ver) == C_OK &&
(ver < 2 || ver > 3)) {
addReplyError(c,"-NOPROTO unsupported protocol version");
if (c->argc >= 2) {
if (getLongLongFromObjectOrReply(c, c->argv[next_arg++], &ver,
"The second argument should the protocol version if provided") != C_OK) {
return;
}
if (!ver && next_arg < c->argc) {
addReplyError(c,"Need to provide an protocol version for other arguments");
if (ver < 2 || ver > 3) {
addReplyError(c,"-NOPROTO unsupported protocol version");
return;
}
}
for (int j = next_arg; j < c->argc; j++) {
int moreargs = (c->argc-1) - j;
......
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