File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -2816,6 +2816,18 @@ static size_t append_system_bin_dirs(char *path, size_t size)
28162816}
28172817#endif
28182818
2819+ static int is_system32_path (const char * path )
2820+ {
2821+ WCHAR system32 [MAX_LONG_PATH ], wpath [MAX_LONG_PATH ];
2822+
2823+ if (xutftowcs_long_path (wpath , path ) < 0 ||
2824+ !GetSystemDirectoryW (system32 , ARRAY_SIZE (system32 )) ||
2825+ _wcsicmp (system32 , wpath ))
2826+ return 0 ;
2827+
2828+ return 1 ;
2829+ }
2830+
28192831static void setup_windows_environment (void )
28202832{
28212833 char * tmp = getenv ("TMPDIR" );
@@ -2856,7 +2868,8 @@ static void setup_windows_environment(void)
28562868 strbuf_addstr (& buf , tmp );
28572869 if ((tmp = getenv ("HOMEPATH" ))) {
28582870 strbuf_addstr (& buf , tmp );
2859- if (is_directory (buf .buf ))
2871+ if (!is_system32_path (buf .buf ) &&
2872+ is_directory (buf .buf ))
28602873 setenv ("HOME" , buf .buf , 1 );
28612874 else
28622875 tmp = NULL ; /* use $USERPROFILE */
You can’t perform that action at this time.
0 commit comments