Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 38d2750

Browse files
kbleesgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Stepan Kasal <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e96942e commit 38d2750

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

compat/mingw.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,8 +1199,7 @@ static int lookup_env(char **env, const char *name, size_t nmln)
11991199
int i;
12001200

12011201
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])
12041203
/* matches */
12051204
return i;
12061205
}

0 commit comments

Comments
 (0)