diff options
author | Ron Yorston <rmy@pobox.com> | 2018-11-29 11:37:47 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2018-11-29 11:37:47 +0000 |
commit | 9dbddc7e030355e4151af39ced599cca3fd6ac89 (patch) | |
tree | cf54b834b6a0053e4f81c2aba136ce862c6da18e | |
parent | 9271207c4eafe6e63fa14fdb02ee36f32d4b2a21 (diff) | |
download | busybox-w32-9dbddc7e030355e4151af39ced599cca3fd6ac89.tar.gz busybox-w32-9dbddc7e030355e4151af39ced599cca3fd6ac89.tar.bz2 busybox-w32-9dbddc7e030355e4151af39ced599cca3fd6ac89.zip |
ash: consolidate tests for variables not to convert
We usually convert backslashes to slashes when importing environment
variables into the shell. Exceptions are if the user has set the -X
option, SYSTEMROOT and COMSPEC. Perform these tests all at once rather
than separately.
-rw-r--r-- | shell/ash.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/shell/ash.c b/shell/ash.c index 29d93cdde..5ac118dd0 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -14555,14 +14555,11 @@ init(void) | |||
14555 | for (start = *envp;start < end;start++) | 14555 | for (start = *envp;start < end;start++) |
14556 | *start = toupper(*start); | 14556 | *start = toupper(*start); |
14557 | 14557 | ||
14558 | /* skip conversion of variables known to cause problems */ | 14558 | /* Convert backslashes to forward slashes in value but |
14559 | if ( strncmp(*envp, "SYSTEMROOT=", 11) == 0 || | 14559 | * not if we're on Windows XP or for variables known to |
14560 | strncmp(*envp, "COMSPEC=", 8) == 0 ) { | 14560 | * cause problems */ |
14561 | continue; | 14561 | if ( !xp && strncmp(*envp, "SYSTEMROOT=", 11) != 0 && |
14562 | } | 14562 | strncmp(*envp, "COMSPEC=", 8) != 0 ) { |
14563 | |||
14564 | /* convert backslashes to forward slashes in value */ | ||
14565 | if (!xp) { | ||
14566 | convert_slashes(end+1); | 14563 | convert_slashes(end+1); |
14567 | } | 14564 | } |
14568 | 14565 | ||