hush: revert a recent buggy change which resulted in two HUSH_VERSIONs
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
parent
83b900fb82
commit
605067b426
11
shell/hush.c
11
shell/hush.c
@ -7329,14 +7329,10 @@ int hush_main(int argc, char **argv)
|
|||||||
* therefore we xstrdup: */
|
* therefore we xstrdup: */
|
||||||
G.shell_ver.varstr = xstrdup(hush_version_str),
|
G.shell_ver.varstr = xstrdup(hush_version_str),
|
||||||
G.top_var = &G.shell_ver;
|
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");
|
debug_printf_env("unsetenv '%s'\n", "HUSH_VERSION");
|
||||||
unsetenv("HUSH_VERSION"); /* in case it exists in initial env */
|
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;
|
cur_var = G.top_var;
|
||||||
e = environ;
|
e = environ;
|
||||||
if (e) while (*e) {
|
if (e) while (*e) {
|
||||||
@ -7350,6 +7346,9 @@ int hush_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
e++;
|
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 */
|
/* Export PWD */
|
||||||
set_pwd_var(/*exp:*/ 1);
|
set_pwd_var(/*exp:*/ 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user