From 1ae2be2af8181b1eaeee51cd5570dbf22eab0548 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Sun, 13 Mar 2016 14:21:44 +1000 Subject: [PATCH] * config.c: GLOB_NOMATCH case --- src/config.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/config.c b/src/config.c index ac70d80..a77ce9d 100644 --- a/src/config.c +++ b/src/config.c @@ -182,6 +182,8 @@ f2b_config_load(f2b_config_t *config, const char *path, bool recursion) { return false; } + f2b_log_msg(log_debug, "processing config file: %s", path); + while (1) { p = fgets(line, sizeof(line), f); if (!p && (feof(f) || ferror(f))) @@ -237,6 +239,7 @@ f2b_config_load(f2b_config_t *config, const char *path, bool recursion) { if (recursion && config->main && (param = f2b_config_param_find(config->main->param, "includes"))) { struct stat st; + int ret = 0; if (stat(param->value, &st) != 0) { f2b_log_msg(log_warn, "path in 'includes' option not exists, ignored"); return true; @@ -249,6 +252,9 @@ f2b_config_load(f2b_config_t *config, const char *path, bool recursion) { char pattern[PATH_MAX] = ""; glob_t globbuf; snprintf(pattern, sizeof(pattern), "%s/*.conf", param->value); + ret = glob(pattern, 0, NULL, &globbuf); + if (ret == GLOB_NOMATCH) + return true; if (glob(pattern, 0, NULL, &globbuf) != 0) { f2b_log_msg(log_error, "glob on 'includes' dir failed"); return false;