aboutsummaryrefslogtreecommitdiffstats
path: root/main/asterisk/ASTERISK-19107.patch
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-12-27 11:34:28 +0200
committerTimo Teräs <timo.teras@iki.fi>2011-12-27 11:35:08 +0200
commitb08c247feb01c316ebbcc84d1d49279c2b9719cc (patch)
tree5cd573218759438352fddb32eaa1463eae294103 /main/asterisk/ASTERISK-19107.patch
parent364d2c0ad53e66d2a7bc07a50651de7755ceab7c (diff)
downloadaports-b08c247feb01c316ebbcc84d1d49279c2b9719cc.tar.bz2
aports-b08c247feb01c316ebbcc84d1d49279c2b9719cc.tar.xz
main/asterisk: add few useful new features from asterisk bug reports
Diffstat (limited to 'main/asterisk/ASTERISK-19107.patch')
-rw-r--r--main/asterisk/ASTERISK-19107.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/main/asterisk/ASTERISK-19107.patch b/main/asterisk/ASTERISK-19107.patch
new file mode 100644
index 0000000000..cb43615b24
--- /dev/null
+++ b/main/asterisk/ASTERISK-19107.patch
@@ -0,0 +1,60 @@
+diff --git a/main/config.c b/main/config.c
+index 498ae99..0f5f0e2 100644
+--- a/main/config.c
++++ b/main/config.c
+@@ -1199,9 +1199,11 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
+ if (newcat)
+ ast_category_append(cfg, *cat);
+ } else if (cur[0] == '#') { /* A directive - #include or #exec */
++ struct ast_config *res;
+ char *cur2;
+ char real_inclusion_name[256];
+ int do_include = 0; /* otherwise, it is exec */
++ int quiet = 0;
+
+ cur++;
+ c = cur;
+@@ -1221,6 +1223,9 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
+ }
+ if (!strcasecmp(cur, "include")) {
+ do_include = 1;
++ } else if (!strcasecmp(cur, "-include")) {
++ do_include = 1;
++ quiet = 1;
+ } else if (!strcasecmp(cur, "exec")) {
+ if (!ast_opt_exec_includes) {
+ ast_log(LOG_WARNING, "Cannot perform #exec unless execincludes option is enabled in asterisk.conf (options section)!\n");
+@@ -1233,7 +1238,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
+
+ if (c == NULL) {
+ ast_log(LOG_WARNING, "Directive '#%s' needs an argument (%s) at line %d of %s\n",
+- do_include ? "include" : "exec",
++ cur,
+ do_include ? "filename" : "/path/to/executable",
+ lineno,
+ configfile);
+@@ -1275,10 +1280,13 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
+ /* record this inclusion */
+ ast_include_new(cfg, cfg->include_level == 1 ? "" : configfile, cur, !do_include, cur2, lineno, real_inclusion_name, sizeof(real_inclusion_name));
+
+- do_include = ast_config_internal_load(cur, cfg, flags, real_inclusion_name, who_asked) ? 1 : 0;
++ res = ast_config_internal_load(cur, cfg, flags, real_inclusion_name, who_asked);
+ if (!ast_strlen_zero(exec_file))
+ unlink(exec_file);
+- if (!do_include) {
++ if (res == CONFIG_STATUS_FILEINVALID) {
++ ast_log(LOG_ERROR, "The file '%s' was listed as a #include but it failed to load.\n", cur);
++ return -1;
++ } else if (res == CONFIG_STATUS_FILEMISSING && !quiet) {
+ ast_log(LOG_ERROR, "The file '%s' was listed as a #include but it does not exist.\n", cur);
+ return -1;
+ }
+@@ -1643,7 +1651,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
+ }
+
+ if (count == 0)
+- return NULL;
++ return CONFIG_STATUS_FILEMISSING;
+
+ return cfg;
+ }