Unverified Commit 0990dec3 authored by gms's avatar gms Committed by GitHub
Browse files

Fix SENTINEL DEBUG with wrong arguments (#10258)

There are two issues in SENTINEL DEBUG:
1. The error message should mention SENTINEL DEBUG
2. Add missing reuturn in args parse.

```
redis> sentinel debug INFO-PERIOD aaa
(error) ERR Invalid argument 'aaa' for SENTINEL SET 'INFO-PERIOD'

redis> sentinel debug a b c d
(error) ERR Unknown option or number of arguments for SENTINEL SET 'a'
redis> ping
(error) ERR Unknown option or number of arguments for SENTINEL SET 'b'
```

Introduced in #9291. Also do some cleanups in the code.
parent 34c288fe
......@@ -3454,7 +3454,6 @@ void addReplySentinelRedisInstance(client *c, sentinelRedisInstance *ri) {
}
void sentinelSetDebugConfigParameters(client *c){
int j;
int badarg = 0; /* Bad argument position for error reporting. */
char *option;
......@@ -3501,7 +3500,7 @@ void sentinelSetDebugConfigParameters(client *c){
}
sentinel_publish_period = ll;
}else if (!strcasecmp(option,"default-down-after") && moreargs > 0) {
} else if (!strcasecmp(option,"default-down-after") && moreargs > 0) {
/* default-down-after <milliseconds> */
robj *o = c->argv[++j];
if (getLongLongFromObject(o,&ll) == C_ERR || ll <= 0) {
......@@ -3584,24 +3583,22 @@ void sentinelSetDebugConfigParameters(client *c){
} else {
addReplyErrorFormat(c,"Unknown option or number of arguments for "
"SENTINEL SET '%s'", option);
"SENTINEL DEBUG '%s'", option);
return;
}
}
addReply(c,shared.ok);
return;
badfmt: /* Bad format errors */
addReplyErrorFormat(c,"Invalid argument '%s' for SENTINEL SET '%s'",
addReplyErrorFormat(c,"Invalid argument '%s' for SENTINEL DEBUG '%s'",
(char*)c->argv[badarg]->ptr,option);
return;
}
void addReplySentinelDebugInfo(client *c) {
void *mbl;
int fields = 0;
......
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