[svn-commits] tilghman: trunk r123715 - in /trunk: ./ pbx/pbx_spool.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jun 18 15:23:59 CDT 2008


Author: tilghman
Date: Wed Jun 18 15:23:58 2008
New Revision: 123715

URL: http://svn.digium.com/view/asterisk?view=rev&rev=123715
Log:
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)

........

Modified:
    trunk/   (props changed)
    trunk/pbx/pbx_spool.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_spool.c?view=diff&rev=123715&r1=123714&r2=123715
==============================================================================
--- trunk/pbx/pbx_spool.c (original)
+++ trunk/pbx/pbx_spool.c Wed Jun 18 15:23:58 2008
@@ -109,7 +109,11 @@
 	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 @@
 					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);




More information about the svn-commits mailing list