From ed8eb229df581c702e44a352aaf4ed47b64bf623 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 3 Apr 2018 09:40:47 +0100 Subject: ash: reinstate applet name variable after forkshell When 'sh --forkshell' is invoked the BB_APPLET_ environment variable is set, but then it's cleared when the environment of the child process is restored. Reinstate it in reinitvar. --- shell/ash.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index 6d24fb55a..2a1ddac39 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -14975,6 +14975,13 @@ reinitvar(void) varinit[i].var_func = varinit_data[i].var_func; } vlineno.var_text = linenovar; + + /* + * BB_APPLET_ was correct when 'sh --forkshell' was started + * but has now been overwritten by the environment from the forkshell + * data block. Reinstate it. + */ + setvareq(bb_applet_pid(), VEXPORT); } /* FIXME: should consider running forkparent() and forkchild() */ -- cgit v1.2.3-55-g6feb