From: Miroslav Lichvar Date: Tue, 20 Jun 2017 15:43:26 +0000 (+0200) Subject: conf: abort when include directive fails X-Git-Tag: 3.2-pre1~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc507bffae8ce8215fb3c14fc63b070be7418bbd;p=thirdparty%2Fchrony.git conf: abort when include directive fails When parsing the include directive, call glob() with the GLOB_ERR and GLOB_NOMAGIC flags, and abort with an error message when matching of the pattern failed with other error than GLOB_NOMATCH. This restores the original behavior of the directive when it didn't allow patterns, but it will still not fail with patterns not matching any files in an existing directory. --- diff --git a/conf.c b/conf.c index 2b9d3765..f5583fa8 100644 --- a/conf.c +++ b/conf.c @@ -1324,10 +1324,14 @@ parse_include(char *line) { glob_t gl; size_t i; + int r; check_number_of_args(line, 1); - if (glob(line, 0, NULL, &gl)) { + if ((r = glob(line, GLOB_ERR | GLOB_NOMAGIC, NULL, &gl)) != 0) { + if (r != GLOB_NOMATCH) + LOG_FATAL("Could not search for files matching %s", line); + DEBUG_LOG("glob of %s failed", line); return; }