Skip to content

Commit

Permalink
Win32: unify environment case-sensitivity
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
kblees authored and gitster committed Jul 21, 2014
1 parent e96942e commit 38d2750
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1199,8 +1199,7 @@ static int lookup_env(char **env, const char *name, size_t nmln)
int i;

for (i = 0; env[i]; i++) {
if (0 == strncmp(env[i], name, nmln)
&& '=' == env[i][nmln])
if (!strncasecmp(env[i], name, nmln) && '=' == env[i][nmln])
/* matches */
return i;
}
Expand Down

0 comments on commit 38d2750

Please sign in to comment.