From 95732b497d12c98613bb3c5db16b61f377501a59 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Wed, 7 Dec 2005 14:08:12 +0000 Subject: Imported from ../bash-3.1.tar.gz. --- builtins/evalfile.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'builtins/evalfile.c') diff --git a/builtins/evalfile.c b/builtins/evalfile.c index c17e547..81be017 100644 --- a/builtins/evalfile.c +++ b/builtins/evalfile.c @@ -39,6 +39,7 @@ #include "../flags.h" #include "../input.h" #include "../execute_cmd.h" +#include "../trap.h" #if defined (HISTORY) # include "../bashhist.h" @@ -82,7 +83,7 @@ _evalfile (filename, flags) size_t file_size; sh_vmsg_func_t *errfunc; #if defined (ARRAY_VARS) - SHELL_VAR *funcname_v, *bash_source_v, *bash_lineno_v; + SHELL_VAR *funcname_v, *nfv, *bash_source_v, *bash_lineno_v; ARRAY *funcname_a, *bash_source_a, *bash_lineno_a; # if defined (DEBUGGER) SHELL_VAR *bash_argv_v, *bash_argc_v; @@ -246,9 +247,16 @@ file_error_and_exit: } #if defined (ARRAY_VARS) + /* These two variables cannot be unset, and cannot be affected by the + sourced file. */ array_pop (bash_source_a); array_pop (bash_lineno_a); - array_pop (funcname_a); + + /* FUNCNAME can be unset, and so can potentially be changed by the + sourced file. */ + GET_ARRAY_FROM_VAR ("FUNCNAME", nfv, funcname_a); + if (nfv == funcname_v) + array_pop (funcname_a); # if defined (DEBUGGER) if ((flags & FEVAL_NOPUSHARGS) == 0) { -- cgit v1.2.3