diff --git a/lib/base/config_file.c b/lib/base/config_file.c index 89608c6f5..b1675ea5f 100644 --- a/lib/base/config_file.c +++ b/lib/base/config_file.c @@ -535,6 +535,22 @@ heim_config_parse_dir_multi(heim_context context, return 0; } +static int +is_devnull(struct stat *st) +{ +#ifdef WIN32 + return 0; +#else + struct stat devnullst; + + if (stat("/dev/null", &devnullst) == -1) + return 0; + return st->st_dev == devnullst.st_dev && st->st_ino == devnullst.st_ino; +#endif +} + +HEIMDAL_THREAD_LOCAL int config_include_depth = 0; + /** * Parse a configuration file and add the result into res. This * interface can be used to parse several configuration files into one @@ -548,8 +564,6 @@ heim_config_parse_dir_multi(heim_context context, * @ingroup heim_support */ -HEIMDAL_THREAD_LOCAL int config_include_depth = 0; - heim_error_code heim_config_parse_file_multi(heim_context context, const char *fname, @@ -630,7 +644,7 @@ heim_config_parse_file_multi(heim_context context, goto out; } - if (!S_ISREG(st.st_mode)) { + if (!S_ISREG(st.st_mode) && !is_devnull(&st)) { (void) fclose(f.f); heim_set_error_message(context, EISDIR, "not a regular file %s: %s", fname, strerror(EISDIR));