aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2024-05-10 14:32:45 +0100
committerRon Yorston <rmy@pobox.com>2024-05-10 14:32:45 +0100
commitbb128070e590234f8b63fb1d67f7621a1b4b3ff3 (patch)
treedf99454212ae35178445b36e55e159b0e28ee7eb
parentfdff0f9e8077fcf0e25a567c2be9e8da71c1676d (diff)
downloadbusybox-w32-bb128070e590234f8b63fb1d67f7621a1b4b3ff3.tar.gz
busybox-w32-bb128070e590234f8b63fb1d67f7621a1b4b3ff3.tar.bz2
busybox-w32-bb128070e590234f8b63fb1d67f7621a1b4b3ff3.zip
ash: -X option shouldn't alter environment variables
When a shell was started with the -X option, environment variables had forward slashes changed to backslashes. This is unnecessary and counterproductive. Adjust how the state of winxp is handled to avoid this. (GitHub issue #415)
-rw-r--r--shell/ash.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c
index fd09e7662..b753678c0 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -2944,11 +2944,11 @@ listvars(int on, int off, struct strlist *lp, char ***end)
2944static void 2944static void
2945setwinxp(int on) 2945setwinxp(int on)
2946{ 2946{
2947 static smallint is_winxp; 2947 static smallint is_winxp = 1;
2948 struct var **vpp; 2948 struct var **vpp;
2949 struct var *vp; 2949 struct var *vp;
2950 2950
2951 if (++on == is_winxp) 2951 if (on == is_winxp)
2952 return; 2952 return;
2953 is_winxp = on; 2953 is_winxp = on;
2954 2954
@@ -2959,7 +2959,7 @@ setwinxp(int on)
2959 if (!end || is_prefixed_with(vp->var_text, "COMSPEC=") || 2959 if (!end || is_prefixed_with(vp->var_text, "COMSPEC=") ||
2960 is_prefixed_with(vp->var_text, "SYSTEMROOT=")) 2960 is_prefixed_with(vp->var_text, "SYSTEMROOT="))
2961 continue; 2961 continue;
2962 if (!winxp) 2962 if (!on)
2963 bs_to_slash(end + 1); 2963 bs_to_slash(end + 1);
2964 else 2964 else
2965 slash_to_bs(end + 1); 2965 slash_to_bs(end + 1);