From: Florian Forster Date: Fri, 13 Aug 2010 21:15:48 +0000 (+0200) Subject: src/configfile.c: Continue parsing config files if stat'ing one file fails. X-Git-Tag: collectd-4.9.4~26 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3d96322c6330132dd67312b72cb62df10a7f09cf;p=collectd.git src/configfile.c: Continue parsing config files if stat'ing one file fails. --- diff --git a/src/configfile.c b/src/configfile.c index 2eea2362..b1cd7b86 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -700,11 +700,10 @@ static oconfig_item_t *cf_read_generic (const char *path, int depth) if (status != 0) { char errbuf[1024]; - ERROR ("configfile: stat (%s) failed: %s", + WARNING ("configfile: stat (%s) failed: %s", path_ptr, sstrerror (errno, errbuf, sizeof (errbuf))); - oconfig_free (root); - return (NULL); + continue; } if (S_ISREG (statbuf.st_mode)) @@ -713,7 +712,7 @@ static oconfig_item_t *cf_read_generic (const char *path, int depth) temp = cf_read_dir (path_ptr, depth); else { - ERROR ("configfile: %s is neither a file nor a " + WARNING ("configfile: %s is neither a file nor a " "directory.", path); continue; } @@ -730,6 +729,12 @@ static oconfig_item_t *cf_read_generic (const char *path, int depth) wordfree (&we); + if (root->children == NULL) + { + oconfig_free (root); + return (NULL); + } + return (root); } /* oconfig_item_t *cf_read_generic */ /* #endif HAVE_WORDEXP_H */