From cb52aa06833a69e57b5e26337e51a4d375b6d8fb Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sat, 25 Oct 2008 18:10:08 +0000 Subject: [PATCH] Fix reading configuration files that do not end with a newline. --- src/conf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/conf.c b/src/conf.c index 56810337..6ee54f5a 100644 --- a/src/conf.c +++ b/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 == '#') -- 2.39.5