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);
|
||||
|
||||
for(;;) {
|
||||
if(feof(fp)) {
|
||||
err = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
line = readline(fp, &buffer, &bufsize);
|
||||
|
||||
if(!line) {
|
||||
|
@ -350,11 +355,6 @@ int read_config_file(avl_tree_t *config_tree, const char *fname)
|
|||
break;
|
||||
}
|
||||
|
||||
if(feof(fp)) {
|
||||
err = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
lineno++;
|
||||
|
||||
if(!*line || *line == '#')
|
||||
|
|
Loading…
Reference in a new issue