FS-5567 --resolve
This commit is contained in:
parent
a4123ab896
commit
518b5a802e
|
@ -1328,20 +1328,24 @@ static FILE *preprocess_exec(const char *cwd, const char *command, FILE *write_f
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static FILE *preprocess_glob(const char *cwd, const char *pattern, FILE *write_fd, int rlevel)
|
static FILE *preprocess_glob(const char *cwd, const char *pattern, FILE *write_fd, int rlevel, switch_bool_t ignore_nomatch)
|
||||||
{
|
{
|
||||||
char *full_path = NULL;
|
char *full_path = NULL;
|
||||||
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 globres;
|
||||||
|
|
||||||
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) {
|
globres = glob(pattern, ignore_nomatch ? GLOB_NOMATCH : GLOB_NOCHECK, NULL, &glob_data);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error including %s\n", pattern);
|
if ( globres != 0) {
|
||||||
|
if ( !ignore_nomatch || globres != GLOB_NOMATCH ) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error including %s\n", pattern);
|
||||||
|
}
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1496,7 +1500,9 @@ static int preprocess(const char *cwd, const char *file, FILE *write_fd, int rle
|
||||||
} else if (!strcasecmp(tcmd, "exec-set")) {
|
} else if (!strcasecmp(tcmd, "exec-set")) {
|
||||||
preprocess_exec_set(targ);
|
preprocess_exec_set(targ);
|
||||||
} else if (!strcasecmp(tcmd, "include")) {
|
} else if (!strcasecmp(tcmd, "include")) {
|
||||||
preprocess_glob(cwd, targ, write_fd, rlevel + 1);
|
preprocess_glob(cwd, targ, write_fd, rlevel + 1, SWITCH_FALSE);
|
||||||
|
} else if (!strcasecmp(tcmd, "include_silent")) {
|
||||||
|
preprocess_glob(cwd, targ, write_fd, rlevel + 1, SWITCH_TRUE);
|
||||||
} else if (!strcasecmp(tcmd, "exec")) {
|
} else if (!strcasecmp(tcmd, "exec")) {
|
||||||
preprocess_exec(cwd, targ, write_fd, rlevel + 1);
|
preprocess_exec(cwd, targ, write_fd, rlevel + 1);
|
||||||
}
|
}
|
||||||
|
@ -1556,7 +1562,9 @@ static int preprocess(const char *cwd, const char *file, FILE *write_fd, int rle
|
||||||
} else if (!strcasecmp(cmd, "exec-set")) {
|
} else if (!strcasecmp(cmd, "exec-set")) {
|
||||||
preprocess_exec_set(arg);
|
preprocess_exec_set(arg);
|
||||||
} else if (!strcasecmp(cmd, "include")) {
|
} else if (!strcasecmp(cmd, "include")) {
|
||||||
preprocess_glob(cwd, arg, write_fd, rlevel + 1);
|
preprocess_glob(cwd, arg, write_fd, rlevel + 1, SWITCH_FALSE);
|
||||||
|
} else if (!strcasecmp(cmd, "include_silent")) {
|
||||||
|
preprocess_glob(cwd, arg, write_fd, rlevel + 1, SWITCH_TRUE);
|
||||||
} else if (!strcasecmp(cmd, "exec")) {
|
} else if (!strcasecmp(cmd, "exec")) {
|
||||||
preprocess_exec(cwd, arg, write_fd, rlevel + 1);
|
preprocess_exec(cwd, arg, write_fd, rlevel + 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue