Code

src/configfile.c: Continue parsing config files if stat'ing one file fails.
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Fri, 13 Aug 2010 21:15:48 +0000 (23:15 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Fri, 13 Aug 2010 21:17:34 +0000 (23:17 +0200)
src/configfile.c

index 2eea2362a5a39396eaabacef5a339202a624ad2d..b1cd7b8634062670a6a22e548ab77ac4cb0e2566 100644 (file)
@@ -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 */