[collectd] [PATCH] configfile.c: Abort if any config file could not	be read.
    Sebastian Harl 
    sh at tokkee.org
       
    Thu Mar 20 11:02:06 CET 2008
    
    
  
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 at tokkee.org>
---
 src/configfile.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/configfile.c b/src/configfile.c
index ef997fa..63b926a 100644
--- a/src/configfile.c
+++ b/src/configfile.c
@@ -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);
-- 
1.5.4.3.325.g6d216
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080320/437a6206/attachment.pgp 
    
    
More information about the collectd
mailing list