mirror of https://mirror.osredm.com/root/redis.git
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){
|
void sentinelSetDebugConfigParameters(client *c){
|
||||||
|
|
||||||
int j;
|
int j;
|
||||||
int badarg = 0; /* Bad argument position for error reporting. */
|
int badarg = 0; /* Bad argument position for error reporting. */
|
||||||
char *option;
|
char *option;
|
||||||
|
@ -3584,24 +3583,22 @@ void sentinelSetDebugConfigParameters(client *c){
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
addReplyErrorFormat(c,"Unknown option or number of arguments for "
|
addReplyErrorFormat(c,"Unknown option or number of arguments for "
|
||||||
"SENTINEL SET '%s'", option);
|
"SENTINEL DEBUG '%s'", option);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addReply(c,shared.ok);
|
addReply(c,shared.ok);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
badfmt: /* Bad format errors */
|
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);
|
(char*)c->argv[badarg]->ptr,option);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void addReplySentinelDebugInfo(client *c) {
|
void addReplySentinelDebugInfo(client *c) {
|
||||||
|
|
||||||
void *mbl;
|
void *mbl;
|
||||||
int fields = 0;
|
int fields = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue