diff options
author | Tilghman Lesher <tilghman@meg.abyt.es> | 2008-06-18 20:23:58 +0000 |
---|---|---|
committer | Tilghman Lesher <tilghman@meg.abyt.es> | 2008-06-18 20:23:58 +0000 |
commit | c86e26e66be01652bbc2d62da3f8a7da7be53d43 (patch) | |
tree | f7429d4eda24f007ce36a4685410b577d8fcac04 /pbx/pbx_spool.c | |
parent | 8d353eb15ab8ba9c0edba76dfb955b5f13bf20f3 (diff) |
Merged revisions 123710 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r123710 | tilghman | 2008-06-18 15:22:42 -0500 (Wed, 18 Jun 2008) | 7 lines
Set the variables top-down, so that if a script sets a variable more than once,
the last one will take precedence.
(closes issue #12673)
Reported by: phber
Patches:
20080519__bug12673.diff.txt uploaded by Corydon76 (license 14)
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@123715 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx/pbx_spool.c')
-rw-r--r-- | pbx/pbx_spool.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c index 793ccde55..37ff0edad 100644 --- a/pbx/pbx_spool.c +++ b/pbx/pbx_spool.c @@ -109,7 +109,11 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f) char buf[256]; char *c, *c2; int lineno = 0; - struct ast_variable *var; + struct ast_variable *var, *last = o->vars; + + while (last && last->next) { + last = last->next; + } while(fgets(buf, sizeof(buf), f)) { lineno++; @@ -205,8 +209,13 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f) if (c2) { var = ast_variable_new(c, c2, fn); if (var) { - var->next = o->vars; - o->vars = var; + /* Always insert at the end, because some people want to treat the spool file as a script */ + if (last) { + last->next = var; + } else { + o->vars = var; + } + last = var; } } else ast_log(LOG_WARNING, "Malformed \"%s\" argument. Should be \"%s: variable=value\"\n", buf, buf); |