Fix reading configuration files that do not end with a newline.
This commit is contained in:
parent
b2cee41b18
commit
cb52aa0683
1 changed files with 5 additions and 5 deletions
10
src/conf.c
10
src/conf.c
|
@ -343,6 +343,11 @@ int read_config_file(avl_tree_t *config_tree, const char *fname)
|
||||||
buffer = xmalloc(bufsize);
|
buffer = xmalloc(bufsize);
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
if(feof(fp)) {
|
||||||
|
err = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
line = readline(fp, &buffer, &bufsize);
|
line = readline(fp, &buffer, &bufsize);
|
||||||
|
|
||||||
if(!line) {
|
if(!line) {
|
||||||
|
@ -350,11 +355,6 @@ int read_config_file(avl_tree_t *config_tree, const char *fname)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(feof(fp)) {
|
|
||||||
err = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
lineno++;
|
lineno++;
|
||||||
|
|
||||||
if(!*line || *line == '#')
|
if(!*line || *line == '#')
|
||||||
|
|
Loading…
Reference in a new issue