mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
Cluster: ignore empty lines in nodes.conf.
Even without the user messing manually with the file, it is still possible to have blank lines (just a single "\n" per line) because of how the nodes.conf update/write process works.
This commit is contained in:
parent
6c63df3031
commit
fb659cd334
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user