From 3d96322c6330132dd67312b72cb62df10a7f09cf Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 13 Aug 2010 23:15:48 +0200 Subject: [PATCH] src/configfile.c: Continue parsing config files if stat'ing one file fails. --- src/configfile.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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 */ -- 2.11.0