From: Guus Sliepen Date: Sat, 25 Oct 2008 18:10:08 +0000 (+0000) Subject: Fix reading configuration files that do not end with a newline. X-Git-Tag: import-tinc-1.1~596^2~33 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=cb52aa06833a69e57b5e26337e51a4d375b6d8fb;p=meshlink Fix reading configuration files that do not end with a newline. --- 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 == '#')