Fix reading configuration files that do not end with a newline.

This commit is contained in:
Guus Sliepen 2008-10-25 18:10:08 +00:00
parent b2cee41b18
commit cb52aa0683

View file

@ -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 == '#')