diff --git a/src/cluster.c b/src/cluster.c index 8b698080a..dfba18411 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -101,12 +101,19 @@ int clusterLoadConfig(char *filename) { line = zmalloc(maxline); while(fgets(line,maxline,fp) != NULL) { int argc; - sds *argv = sdssplitargs(line,&argc); - if (argv == NULL) goto fmterr; - + sds *argv; clusterNode *n, *master; char *p, *s; + /* Skip blank lines, they can be created either by users manually + * editing nodes.conf or by the config writing process if stopped + * before the truncate() call. */ + if (line[0] == '\n') continue; + + /* Split the line into arguments for processing. */ + argv = sdssplitargs(line,&argc); + if (argv == NULL) goto fmterr; + /* Create this node if it does not exist */ n = clusterLookupNode(argv[0]); if (!n) {