summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/path.cc11
2 files changed, 10 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 1e5dc7bc5..e185b964a 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2013-07-15 Corinna Vinschen <corinna@vinschen.de>
+
+ * path.cc (symlink_native): Fix common prefix search. Enhance comment.
+
2013-07-11 Corinna Vinschen <corinna@vinschen.de>
* uname.cc (uname): Drop unused code.
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 04dc2a828..6c9bc231e 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1570,11 +1570,12 @@ symlink_native (const char *oldpath, path_conv &win32_newpath)
/* Try hard to keep Windows symlink path relative. */
- /* 1. Find common path prefix. */
- PWCHAR c_old = win32_oldpath.get_nt_native_path ()->Buffer;
- PWCHAR c_new = win32_newpath.get_nt_native_path ()->Buffer;
- /* Windows compatible == always check case insensitive. */
- while (towupper (*c_old++) == towupper (*c_new++))
+ /* 1. Find common path prefix. Skip leading \\?\, but take pre-increment
+ of the following loop into account. */
+ PWCHAR c_old = win32_oldpath.get_nt_native_path ()->Buffer + 3;
+ PWCHAR c_new = win32_newpath.get_nt_native_path ()->Buffer + 3;
+ /* Windows compatible == always check case insensitive. */
+ while (towupper (*++c_old) == towupper (*++c_new))
;
/* The last component could share a common prefix, so make sure we end
up on the first char after the last common backslash. */