summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc11
1 files changed, 6 insertions, 5 deletions
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. */