]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Changes in shared code that don't affect open-vm-tools functionality.
authorVMware, Inc <>
Thu, 24 Feb 2011 21:57:36 +0000 (13:57 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 24 Feb 2011 21:57:36 +0000 (13:57 -0800)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/file/file.c

index 38c356723df1373eebe5ecc3cd371253d4935415..c11c4da178bd377cf40680d1e45f2227519528d2 100644 (file)
@@ -2165,12 +2165,23 @@ File_MapPathPrefix(const char *oldPath,       // IN:
       /*
        * If the prefix matches on a DIRSEPS boundary, or the prefix is the
        * whole string, replace it.
+       *
        * If we don't insist on matching a whole directory name, we could
        * mess things of if one directory is a substring of another.
+       *
+       * Perform a case-insensitive compare on Windows. (There are
+       * case-insensitive filesystems on MacOS also, but the problem
+       * is more acute with Windows because of frequent drive-letter
+       * case mismatches. So in lieu of actually asking the
+       * filesystem, let's just go with a simple ifdef for now.)
        */
 
       if ((oldPathLen >= oldPrefixLen) &&
-          (memcmp(oldPath, oldPrefix, oldPrefixLen) == 0) &&
+#ifdef _WIN32
+          (Str_Strncasecmp(oldPath, oldPrefix, oldPrefixLen) == 0) &&
+#else
+          (Str_Strncmp(oldPath, oldPrefix, oldPrefixLen) == 0) &&
+#endif
           (strchr(VALID_DIRSEPS, oldPath[oldPrefixLen]) ||
               (oldPath[oldPrefixLen] == '\0'))) {
          size_t newPrefixLen = strlen(newPrefix);