Commit 437fc2cb authored by antirez's avatar antirez
Browse files

Cluster: fix error reporting when slaveof is found in config.

parent ac3850ca
......@@ -82,6 +82,7 @@ void resetServerSaveParams() {
void loadServerConfigFromString(char *config) {
char *err = NULL;
int linenum = 0, totlines, i;
int slaveof_linenum = 0;
sds *lines;
lines = sdssplitlen(config,strlen(config),"\n",1,&totlines);
......@@ -244,6 +245,7 @@ void loadServerConfigFromString(char *config) {
goto loaderr;
}
} else if (!strcasecmp(argv[0],"slaveof") && argc == 3) {
slaveof_linenum = linenum;
server.masterhost = sdsnew(argv[1]);
server.masterport = atoi(argv[2]);
server.repl_state = REDIS_REPL_CONNECT;
......@@ -490,13 +492,16 @@ void loadServerConfigFromString(char *config) {
}
sdsfreesplitres(argv,argc);
}
sdsfreesplitres(lines,totlines);
/* Sanity checks. */
if (server.cluster_enabled && server.masterhost) {
linenum = slaveof_linenum;
i = linenum-1;
err = "slaveof directive not allowed in cluster mode";
goto loaderr;
}
sdsfreesplitres(lines,totlines);
return;
loaderr:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment