summaryrefslogtreecommitdiff
path: root/main/config.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2008-12-05 05:41:41 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2008-12-05 05:41:41 +0000
commitda8069394b1e543167b88930e021a18267a6c923 (patch)
tree10e08fbe4543810ad9a2b769a3c962d8a4c5fbda /main/config.c
parent2afd7a09a76d5d62a4efbcb03fa8bd35c8ce5ed1 (diff)
The first file should have a blank config filename in the structure, so that
when a save occurs to a different filename, everything goes to the alternate filename, instead of appending to the original. This is important for the AMI command UpdateConfig. (closes issue #13301) Reported by: trevo Patches: 20081113__bug13301.diff.txt uploaded by Corydon76 (license 14) 20081113__bug13301__1.6.0.diff.txt uploaded by Corydon76 (license 14) Tested by: Corydon76, blitzrage git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161181 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/config.c')
-rw-r--r--main/config.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/main/config.c b/main/config.c
index 4cef91a55..d6510dfbe 100644
--- a/main/config.c
+++ b/main/config.c
@@ -953,7 +953,9 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
if (*c++ != '(')
c = NULL;
catname = cur;
- if (!(*cat = newcat = ast_category_new(catname, ast_strlen_zero(suggested_include_file)?configfile:suggested_include_file, lineno))) {
+ if (!(*cat = newcat = ast_category_new(catname,
+ S_OR(suggested_include_file, cfg->include_level == 1 ? "" : configfile),
+ lineno))) {
return -1;
}
(*cat)->lineno = lineno;
@@ -1076,7 +1078,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
}
/* A #include */
/* record this inclusion */
- inclu = ast_include_new(cfg, configfile, cur, !do_include, cur2, lineno, real_inclusion_name, sizeof(real_inclusion_name));
+ inclu = 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;
if (!ast_strlen_zero(exec_file))
@@ -1133,7 +1135,7 @@ static int process_text_line(struct ast_config *cfg, struct ast_category **cat,
c++;
}
set_new_variable:
- if ((v = ast_variable_new(ast_strip(cur), ast_strip(c), S_OR(suggested_include_file, configfile)))) {
+ if ((v = ast_variable_new(ast_strip(cur), ast_strip(c), S_OR(suggested_include_file, cfg->include_level == 1 ? "" : configfile)))) {
v->lineno = lineno;
v->object = object;
*last_cat = 0;