From ee3d37a591cf2db3dd1444b2c1e2fcb041f68d33 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Tue, 4 Nov 2003 07:40:29 +0000 Subject: Fix bugs 5798 and 6195. --- expand.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'expand.c') diff --git a/expand.c b/expand.c index 922b1e3..8f9f4b1 100644 --- a/expand.c +++ b/expand.c @@ -97,6 +97,7 @@ recursively_expand_for_file (struct variable *v, struct file *file) { char *value; struct variable_set_list *save = 0; + int set_reading = 0; if (v->expanding) { @@ -114,6 +115,13 @@ recursively_expand_for_file (struct variable *v, struct file *file) current_variable_set_list = file->variables; } + /* If we have no other file-reading context, use the variable's context. */ + if (!reading_file) + { + set_reading = 1; + reading_file = &v->fileinfo; + } + v->expanding = 1; if (v->append) value = allocated_variable_append (v); @@ -121,6 +129,8 @@ recursively_expand_for_file (struct variable *v, struct file *file) value = allocated_variable_expand (v->value); v->expanding = 0; + if (set_reading) + reading_file = 0; if (file) current_variable_set_list = save; -- cgit v1.2.3