Win32: unify environment case-sensitivity
authorKarsten Blees <blees@dcon.de>
Thu, 17 Jul 2014 15:37:58 +0000 (17:37 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Jul 2014 16:32:49 +0000 (09:32 -0700)
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>
compat/mingw.c
index f6c7ad7fd834560432001d1dc46b81dfee99e2de..654bea4828645879430a663a8a805afa5d9e582f 100644 (file)
@@ -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;
        }