Code

configfile.c: Abort if any config file could not be read.
authorSebastian Harl <sh@tokkee.org>
Thu, 20 Mar 2008 10:02:06 +0000 (11:02 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Sat, 22 Mar 2008 08:31:51 +0000 (09:31 +0100)
So far, when including all files from some directory, errors while reading
any of those config files have been reported but otherwise ignored. So,
collectd would run with some potentially incomplete configuration which is
not what I would expect.

Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/configfile.c

index ef997fac73415d38a4b43dca11ed9694923ac425..63b926afd79a25112660fd8ec7bf4a81054d2c48 100644 (file)
@@ -546,12 +546,15 @@ static oconfig_item_t *cf_read_dir (const char *dir, int depth)
                        ERROR ("configfile: Not including `%s/%s' because its"
                                        " name is too long.",
                                        dir, de->d_name);
-                       continue;
+                       oconfig_free (root);
+                       return (NULL);
                }
 
                temp = cf_read_generic (name, depth);
-               if (temp == NULL)
-                       continue;
+               if (temp == NULL) {
+                       oconfig_free (root);
+                       return (NULL);
+               }
 
                cf_ci_append_children (root, temp);
                sfree (temp->children);