Skip to content

Commit df596c9

Browse files
authored
PATCH: ast_variable_update() does not play well with templates (#38)
The "config_c_fix_template_inheritance_overrides.patch" addresses a issue with how ast_variable_retrieve() interacts with templates. There is a similar issue with ast_variable_update(). This "patch" addresses the problem. Resolves: #37
1 parent 448f7e7 commit df596c9

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff --git a/main/config.c b/main/config.c
2+
index e7ac4149a6..e81d3afced 100644
3+
--- a/main/config.c
4+
+++ b/main/config.c
5+
@@ -1533,13 +1533,19 @@ int ast_variable_delete(struct ast_category *category, const char *variable, con
6+
int ast_variable_update(struct ast_category *category, const char *variable,
7+
const char *value, const char *match, unsigned int object)
8+
{
9+
- struct ast_variable *cur, *prev=NULL, *newer=NULL;
10+
+ struct ast_variable *cur, *prev=NULL, *newer=NULL, *matchvar = NULL;
11+
12+
for (cur = category->root; cur; prev = cur, cur = cur->next) {
13+
if (strcasecmp(cur->name, variable) ||
14+
(!ast_strlen_zero(match) && strcasecmp(cur->value, match)))
15+
continue;
16+
+ matchvar = cur;
17+
+ }
18+
19+
+ for (cur = category->root; cur; prev = cur, cur = cur->next) {
20+
+ if (cur != matchvar) {
21+
+ continue;
22+
+ }
23+
if (!(newer = ast_variable_new(variable, value, cur->file)))
24+
return -1;
25+

phreaknet.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,6 +1929,7 @@ phreak_patches() { # $1 = $PATCH_DIR, $2 = $AST_SRC_DIR
19291929

19301930
## Unmerged patches: remove once merged
19311931
git_patch "config_c_fix_template_inheritance_overrides.patch" # config.c: fix template inheritance/overrides
1932+
git_patch "config_c_fix_template_writing.patch" # config.c: fix template inheritance/overrides
19321933

19331934
if [ $AST_MAJOR_VER -lt 21 ]; then
19341935
if [ "$EXTERNAL_CODECS" = "1" ]; then

0 commit comments

Comments
 (0)