Make directory name comparisons on Win32 case insensitive.
authorMagnus Hagander <[email protected]>
Fri, 3 Apr 2009 11:52:12 +0000 (11:52 +0000)
committerMagnus Hagander <[email protected]>
Fri, 3 Apr 2009 11:52:12 +0000 (11:52 +0000)
This method will not catch all different ways since the locale
handling in NTFS doesn't provide an easy way to do that, but it
will hopefully solve the most common cases causing startup
problems when the backend is found in the system PATH.

Attempts to fix bug #4694.

src/port/path.c

index 11788c6c1b83af1ae07b414aea52ad6f23aee1bc..a716e058f46d44e3efa4589936467747f143b112 100644 (file)
@@ -427,7 +427,12 @@ dir_strcmp(const char *s1, const char *s2)
 {
        while (*s1 && *s2)
        {
+#ifndef WIN32
                if (*s1 != *s2 &&
+#else
+                       /* On windows, paths are case-insensitive */
+               if (pg_tolower(*s1) != pg_tolower(*s2) &&
+#endif
                        !(IS_DIR_SEP(*s1) && IS_DIR_SEP(*s2)))
                        return (int) *s1 - (int) *s2;
                s1++, s2++;