mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Fix CONFIG REWRITE handling of unknown options.
There were two problems with the implementation. 1) "save" was not correctly processed when no save point was configured, as reported in issue #1416. 2) The way the code checked if an option existed in the "processed" dictionary was wrong, as we add the element with as a key associated with a NULL value, so dictFetchValue() can't be used to check for existance, but dictFind() must be used, that returns NULL only if the entry does not exist at all.
This commit is contained in:
parent
7e9433cee1
commit
e789384255
@ -1440,6 +1440,8 @@ void rewriteConfigSaveOption(struct rewriteConfigState *state) {
|
||||
server.saveparams[j].seconds, server.saveparams[j].changes);
|
||||
rewriteConfigRewriteLine(state,"save",line,1);
|
||||
}
|
||||
/* Mark "save" as processed in case server.saveparamslen is zero. */
|
||||
rewriteConfigMarkAsProcessed(state,"save");
|
||||
}
|
||||
|
||||
/* Rewrite the dir option, always using absolute paths.*/
|
||||
@ -1578,7 +1580,7 @@ void rewriteConfigRemoveOrphaned(struct rewriteConfigState *state) {
|
||||
|
||||
/* Don't blank lines about options the rewrite process
|
||||
* don't understand. */
|
||||
if (dictFetchValue(state->rewritten,option) == NULL) {
|
||||
if (dictFind(state->rewritten,option) == NULL) {
|
||||
redisLog(REDIS_DEBUG,"Not rewritten option: %s", option);
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user