diff options
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c index b753678c0..4fdc6f1c6 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -15886,9 +15886,16 @@ static void setvar_if_unset(const char *key, const char *value) | |||
15886 | #endif | 15886 | #endif |
15887 | 15887 | ||
15888 | #if ENABLE_PLATFORM_MINGW32 | 15888 | #if ENABLE_PLATFORM_MINGW32 |
15889 | /* | ||
15890 | * Detect if the environment contains certain mixed-case names: | ||
15891 | * | ||
15892 | * Home is present in a standard Windows environment | ||
15893 | * ComSpec is present in WINE | ||
15894 | * ProgramData is present in Cygwin/MSYS2 | ||
15895 | */ | ||
15889 | static int mixed_case_special_name(const char *envp) | 15896 | static int mixed_case_special_name(const char *envp) |
15890 | { | 15897 | { |
15891 | const char *names = "PATH=\0""COMSPEC=\0"; | 15898 | const char *names = "PATH=\0""COMSPEC=\0""PROGRAMDATA=\0"; |
15892 | const char *n; | 15899 | const char *n; |
15893 | 15900 | ||
15894 | for (n = names; *n; ) { | 15901 | for (n = names; *n; ) { |
@@ -15936,6 +15943,11 @@ init(void) | |||
15936 | */ | 15943 | */ |
15937 | for (envp = environ; envp && *envp; envp++) { | 15944 | for (envp = environ; envp && *envp; envp++) { |
15938 | if (mixed_case_special_name(*envp)) { | 15945 | if (mixed_case_special_name(*envp)) { |
15946 | /* mintty sets HOME: unset it */ | ||
15947 | const char *tty = getenv("TERM_PROGRAM"); | ||
15948 | if (tty && strcmp(tty, "mintty") == 0) { | ||
15949 | unsetenv("HOME"); | ||
15950 | } | ||
15939 | break; | 15951 | break; |
15940 | } | 15952 | } |
15941 | } | 15953 | } |