mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
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.
This commit is contained in:
parent
34c288fe11
commit
0990dec3f5
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user