aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-09-17 12:54:21 +0100
committerRon Yorston <rmy@pobox.com>2021-09-17 12:54:21 +0100
commitc13f7782351a4b6ff20f0c0504cb1caab81ea331 (patch)
tree6031d567e1533f80b9c35e41bac5639d8d4043cd
parent9e16eecc70020e9a603d637f6a8fdfc7c95c30e1 (diff)
downloadbusybox-w32-c13f7782351a4b6ff20f0c0504cb1caab81ea331.tar.gz
busybox-w32-c13f7782351a4b6ff20f0c0504cb1caab81ea331.tar.bz2
busybox-w32-c13f7782351a4b6ff20f0c0504cb1caab81ea331.zip
ash: adjust reinitvar() to allow for FUNCNAME
The new FUNCNAME variable, like LINENO, needs special treatment during forkshell.
-rw-r--r--shell/ash.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 5adb95bc5..8e43acdb0 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -2331,6 +2331,9 @@ change_skip_ansi(const char *newval UNUSED_PARAM)
2331{ 2331{
2332 skip_ansi_emulation(TRUE); 2332 skip_ansi_emulation(TRUE);
2333} 2333}
2334
2335# define LINENO_INDEX (5 + 2 * ENABLE_ASH_MAIL + ENABLE_ASH_GETOPTS)
2336# define FUNCNAME_INDEX (LINENO_INDEX + 1)
2334#endif 2337#endif
2335 2338
2336static const struct { 2339static const struct {
@@ -15939,7 +15942,12 @@ reinitvar(void)
15939 struct var **vpp, **old; 15942 struct var **vpp, **old;
15940 15943
15941 for (i=0; i<ARRAY_SIZE(varinit); ++i) { 15944 for (i=0; i<ARRAY_SIZE(varinit); ++i) {
15942 name = varinit_data[i].var_text ? varinit_data[i].var_text : "LINENO="; 15945 if (i == LINENO_INDEX)
15946 name = "LINENO=";
15947 else if (i == FUNCNAME_INDEX)
15948 name = "FUNCNAME=";
15949 else
15950 name = varinit_data[i].var_text;
15943 vpp = hashvar(name); 15951 vpp = hashvar(name);
15944 if ( (old=findvar(vpp, name)) != NULL ) { 15952 if ( (old=findvar(vpp, name)) != NULL ) {
15945 varinit[i] = **old; 15953 varinit[i] = **old;
@@ -15948,6 +15956,7 @@ reinitvar(void)
15948 varinit[i].var_func = varinit_data[i].var_func; 15956 varinit[i].var_func = varinit_data[i].var_func;
15949 } 15957 }
15950 vlineno.var_text = linenovar; 15958 vlineno.var_text = linenovar;
15959 vfuncname.var_text = funcnamevar;
15951} 15960}
15952 15961
15953static void 15962static void