diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/config.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/server/config.c b/server/config.c index 983c7dfae3..30bd6d66bd 100644 --- a/server/config.c +++ b/server/config.c @@ -1951,6 +1951,15 @@ static const char *process_resource_config_nofnmatch(server_rec *s, return NULL; } + else if (optional) { + /* If the optinal flag is set (like for IncludeOptional) we can + * tolerate that no file or directory is present and bail out. + */ + apr_finfo_t finfo; + if (apr_stat(&finfo, fname, APR_FINFO_TYPE, ptemp) != APR_SUCCESS + || finfo.filetype == APR_NOFILE) + return NULL; + } return ap_process_resource_config(s, fname, conftree, p, ptemp); } @@ -2001,6 +2010,12 @@ static const char *process_resource_config_fnmatch(server_rec *s, */ rv = apr_dir_open(&dirp, path, ptemp); if (rv != APR_SUCCESS) { + /* If the directory doesn't exist and the optional flag is set + * there is no need to return an error. + */ + if (rv == APR_ENOENT && optional) { + return NULL; + } return apr_psprintf(p, "Could not open config directory %s: %pm", path, &rv); } |