提交 a80c67e3 authored 作者: Ken Rice's avatar Ken Rice 提交者: Brian West

FS-8818 #resolve refactor X-PRE include to not toss error if there are not files…

FS-8818 #resolve refactor X-PRE include to not toss error if there are not files that match the include
上级 7f5af042
...@@ -1298,15 +1298,20 @@ static FILE *preprocess_glob(const char *cwd, const char *pattern, FILE *write_f ...@@ -1298,15 +1298,20 @@ static FILE *preprocess_glob(const char *cwd, const char *pattern, FILE *write_f
char *dir_path = NULL, *e = NULL; char *dir_path = NULL, *e = NULL;
glob_t glob_data; glob_t glob_data;
size_t n; size_t n;
int glob_return;
if (!switch_is_file_path(pattern)) { if (!switch_is_file_path(pattern)) {
full_path = switch_mprintf("%s%s%s", cwd, SWITCH_PATH_SEPARATOR, pattern); full_path = switch_mprintf("%s%s%s", cwd, SWITCH_PATH_SEPARATOR, pattern);
pattern = full_path; pattern = full_path;
} }
if (glob(pattern, GLOB_NOCHECK, NULL, &glob_data) != 0) { glob_return = glob(pattern, GLOB_ERR, NULL, &glob_data);
if (glob_return == GLOB_NOSPACE || glob_return == GLOB_ABORTED) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error including %s\n", pattern); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error including %s\n", pattern);
goto end; goto end;
} else if (glob_return == GLOB_NOMATCH) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No files to include at %s\n", pattern);
goto end;
} }
for (n = 0; n < glob_data.gl_pathc; ++n) { for (n = 0; n < glob_data.gl_pathc; ++n) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论