diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-06 12:10:51 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-06 12:10:51 +0200 |
commit | 605067b4261df056b0d0e45028a191824bcdce31 (patch) | |
tree | 620641d8e733487f0df3641922d3a2c0c7c4ae86 /shell | |
parent | 83b900fb82a42b56a0130cfe7fb4406fef8b1b54 (diff) | |
download | busybox-605067b4261df056b0d0e45028a191824bcdce31.tar.gz |
hush: revert a recent buggy change which resulted in two HUSH_VERSIONs
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/hush.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/shell/hush.c b/shell/hush.c index 991737c59..541962470 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -7329,14 +7329,10 @@ int hush_main(int argc, char **argv) * therefore we xstrdup: */ G.shell_ver.varstr = xstrdup(hush_version_str), G.top_var = &G.shell_ver; + /* Create shell local variables from the values + * currently living in the environment */ debug_printf_env("unsetenv '%s'\n", "HUSH_VERSION"); unsetenv("HUSH_VERSION"); /* in case it exists in initial env */ - /* reinstate HUSH_VERSION in environment */ - debug_printf_env("putenv '%s'\n", G.shell_ver.varstr); - putenv(G.shell_ver.varstr); - - /* Initialize our shell local variables with the values - * currently living in the environment */ cur_var = G.top_var; e = environ; if (e) while (*e) { @@ -7350,6 +7346,9 @@ int hush_main(int argc, char **argv) } e++; } + /* (Re)insert HUSH_VERSION into env (AFTER we scanned the env!) */ + debug_printf_env("putenv '%s'\n", G.shell_ver.varstr); + putenv(G.shell_ver.varstr); /* Export PWD */ set_pwd_var(/*exp:*/ 1); |