From 9dbddc7e030355e4151af39ced599cca3fd6ac89 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 29 Nov 2018 11:37:47 +0000 Subject: 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. --- shell/ash.c | 13 +++++-------- 1 file 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) for (start = *envp;start < end;start++) *start = toupper(*start); - /* skip conversion of variables known to cause problems */ - if ( strncmp(*envp, "SYSTEMROOT=", 11) == 0 || - strncmp(*envp, "COMSPEC=", 8) == 0 ) { - continue; - } - - /* convert backslashes to forward slashes in value */ - if (!xp) { + /* Convert backslashes to forward slashes in value but + * not if we're on Windows XP or for variables known to + * cause problems */ + if ( !xp && strncmp(*envp, "SYSTEMROOT=", 11) != 0 && + strncmp(*envp, "COMSPEC=", 8) != 0 ) { convert_slashes(end+1); } -- cgit v1.2.3-55-g6feb