]> git.meshlink.io Git - meshlink/commitdiff
Fix reading configuration files that do not end with a newline.
authorGuus Sliepen <guus@tinc-vpn.org>
Sat, 25 Oct 2008 18:10:08 +0000 (18:10 +0000)
committerGuus Sliepen <guus@tinc-vpn.org>
Sat, 25 Oct 2008 18:10:08 +0000 (18:10 +0000)
src/conf.c

index 568103373c9a5a1612c22cfa779143a5a04ce07c..6ee54f5a7f1644f639c931efd331a8525472d7f1 100644 (file)
@@ -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 == '#')