提交 d95592b1 编写于 作者: A antirez

CONFIG REWRITE: support for dir and slaveof.

上级 2bc31e55
......@@ -1329,9 +1329,21 @@ void rewriteConfigSaveOption(struct rewriteConfigState *state) {
}
void rewriteConfigDirOption(struct rewriteConfigState *state) {
char cwd[1024];
if (getcwd(cwd,sizeof(cwd)) == NULL) return; /* no rewrite on error. */
rewriteConfigStringOption(state,"dir",cwd,NULL);
}
void rewriteConfigSlaveofOption(struct rewriteConfigState *state) {
sds line;
/* If this is a master, we want all the slaveof config options
* in the file to be removed. */
if (server.masterhost == NULL) return;
line = sdscatprintf(sdsempty(),"slaveof %s %d",
server.masterhost, server.masterport);
rewriteConfigRewriteLine(state,"slaveof",line,1);
}
void rewriteConfigAppendonlyOption(struct rewriteConfigState *state) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册