mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 08:08:53 -05:00
Fix command line startup --sentinel problem (#11591)
There is a issue with --sentinel: ``` [root]# src/redis-server sentinel.conf --sentinel --loglevel verbose *** FATAL CONFIG FILE ERROR (Redis 255.255.255) *** Reading the configuration file, at line 352 >>> 'sentinel "--loglevel" "verbose"' Unrecognized sentinel configuration statement ``` This is because in #10660 (Redis 7.0.1), `--` prefix change break it. In this PR, we will handle `--sentinel` the same as we did for `--save` in #10866. i.e. it's a pseudo config option with no value.
This commit is contained in:
parent
e48ac075c0
commit
8f13ac10b4
18
src/server.c
18
src/server.c
@ -7024,6 +7024,24 @@ int main(int argc, char **argv) {
|
||||
* so it will become `--save ""` and will follow the same reset thing. */
|
||||
options = sdscat(options, "\"\"");
|
||||
}
|
||||
else if ((j != argc-1) && argv[j+1][0] == '-' && argv[j+1][1] == '-' &&
|
||||
!strcasecmp(argv[j], "--sentinel"))
|
||||
{
|
||||
/* Special case: handle some things like `--sentinel --config value`.
|
||||
* It is a pseudo config option with no value. In this case, if next
|
||||
* argument starts with `--`, we will reset handled_last_config_arg flag.
|
||||
* We are doing it to be compatible with pre 7.0 behavior (which we
|
||||
* break it in #10660, 7.0.1). */
|
||||
options = sdscat(options, "");
|
||||
handled_last_config_arg = 1;
|
||||
}
|
||||
else if ((j == argc-1) && !strcasecmp(argv[j], "--sentinel")) {
|
||||
/* Special case: when --sentinel is the last argument.
|
||||
* It is a pseudo config option with no value. In this case, do nothing.
|
||||
* We are doing it to be compatible with pre 7.0 behavior (which we
|
||||
* break it in #10660, 7.0.1). */
|
||||
options = sdscat(options, "");
|
||||
}
|
||||
} else {
|
||||
/* Means that we are passing both config name and it's value in the same arg,
|
||||
* like "--port 6380", so we need to reset handled_last_config_arg flag. */
|
||||
|
Loading…
Reference in New Issue
Block a user