[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-patches
Subject:    [Mono-patches] [mono/mono] d5289ff0: Fix win32 file name
From:       "Rodrigo Kumpera (kumpera () gmail ! com)" <mono-patches () lists ! ximian ! com>
Date:       2011-03-31 19:14:39
Message-ID: 20110331191439.3DA282212A () mono ! ximian ! com
[Download RAW message or body]


   Branch: refs/heads/master
     Home: https://github.com/mono/mono

   Commit: d5289ff0c133d224b5fe301c045bea339a5e42fa
   Author: Rodrigo Kumpera <kumpera@gmail.com>
     Date: 03/31/2011 15:11:26
      URL: https://github.com/mono/mono/commit/d5289ff0c133d224b5fe301c045bea339a5e42fa

Fix win32 file name canonicalization.

	* mono-path.c (mono_path_canonicalize): Properly canonicalize
	non UNC paths with an extra backslash. Eg:
	c:\foo\\bar was been canonicalized to c:\\foo\bar.

	This was breaking assembly loading in some rare cases.

Changed paths:
 M mono/utils/mono-path.c

Modified: mono/utils/mono-path.c
===================================================================
--- a/mono/utils/mono-path.c
+++ b/mono/utils/mono-path.c
@@ -81,8 +81,11 @@ mono_path_canonicalize (const char *path)
 		pos = strchr (lastpos, G_DIR_SEPARATOR);
 	}
 
-#ifdef HOST_WIN32 /* For UNC paths the first '\' is removed. */
-	if (*(lastpos-1) == G_DIR_SEPARATOR && *(lastpos-2) == G_DIR_SEPARATOR)
+#ifdef HOST_WIN32
+	/* Avoid removing the first '\' for UNC paths. We must make sure that it's indeed an UNC path
+	by checking if the \\ pair happens exactly at the end of the string.
+	*/
+	if (*(lastpos-1) == G_DIR_SEPARATOR && *(lastpos-2) == G_DIR_SEPARATOR && *lastpos == 0)
 		lastpos = lastpos-1;
 #endif
 	




_______________________________________________
Mono-patches maillist  -  Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic