Win32: unify environment case-sensitivity
The environment on Windows is case-insensitive. Some environment functions (such as unsetenv and make_augmented_environ) have always used case- sensitive comparisons instead, while others (getenv, putenv, sorting in spawn*) were case-insensitive. Prevent potential inconsistencies by using case-insensitive comparison in lookup_env (used by putenv, unsetenv and make_augmented_environ). Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Stepan Kasal <kasal@ucw.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Karsten Blees committed
Jul 17, 2014 at 17:37 UTC
38d2750126f326c21b06d63e7c21b05d3a6b74f7
1 file changed
+1
-2
compat/mingw.c
+1
-2
@@ -1199,8 +1199,7 @@ static int lookup_env(char **env, const char *name, size_t nmln)
1199
int i;
1200
1201
for (i = 0; env[i]; i++) {
1202
- if (0 == strncmp(env[i], name, nmln)
1203
- && '=' == env[i][nmln])
1202
+ if (!strncasecmp(env[i], name, nmln) && '=' == env[i][nmln])
1203
/* matches */
1204
return i;
1205
}