aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c7
-rw-r--r--shell/ash_test/ash-standalone/noexec_gets_no_env.right2
-rwxr-xr-xshell/ash_test/ash-standalone/noexec_gets_no_env.tests3
3 files changed, 10 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 70b7ae32a..81ac563fb 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -7008,8 +7008,11 @@ tryexec(USE_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char *
#if ENABLE_FEATURE_SH_STANDALONE
if (applet_no >= 0) {
- if (APPLET_IS_NOEXEC(applet_no))
+ if (APPLET_IS_NOEXEC(applet_no)) {
+ while (*envp)
+ putenv(*envp++);
run_applet_no_and_exit(applet_no, argv);
+ }
/* re-exec ourselves with the new arguments */
execve(bb_busybox_exec_path, argv, envp);
/* If they called chroot or otherwise made the binary no longer
@@ -12094,7 +12097,7 @@ exportcmd(int argc UNUSED_PARAM, char **argv)
char *name;
const char *p;
char **aptr;
- int flag = argv[0][0] == 'r'? VREADONLY : VEXPORT;
+ int flag = argv[0][0] == 'r' ? VREADONLY : VEXPORT;
if (nextopt("p") != 'p') {
aptr = argptr;
diff --git a/shell/ash_test/ash-standalone/noexec_gets_no_env.right b/shell/ash_test/ash-standalone/noexec_gets_no_env.right
new file mode 100644
index 000000000..3d55d73b8
--- /dev/null
+++ b/shell/ash_test/ash-standalone/noexec_gets_no_env.right
@@ -0,0 +1,2 @@
+VAR7=VAL
+0
diff --git a/shell/ash_test/ash-standalone/noexec_gets_no_env.tests b/shell/ash_test/ash-standalone/noexec_gets_no_env.tests
new file mode 100755
index 000000000..5e12e5a25
--- /dev/null
+++ b/shell/ash_test/ash-standalone/noexec_gets_no_env.tests
@@ -0,0 +1,3 @@
+export VAR7=VAL
+env | grep ^VAR7=
+echo $?