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.
This commit is contained in:
Miroslav Lichvar 2017-06-20 17:43:26 +02:00
parent 0dbfe020ad
commit cc507bffae

6
conf.c
View file

@ -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;
}