diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2013-07-15 13:57:20 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2013-07-15 13:57:20 +0400 |
commit | 7556523159423e7af8af36153d99ee81877ffc11 (patch) | |
tree | 95c0be424d7a2c900b1e54ce90c0ebede3ec4ff4 /winsup/cygwin/path.cc | |
parent | a18c8c36880ebde06b5e40eec3c8cb89d1ec2bbb (diff) |
* path.cc (symlink_native): Fix common prefix search. Enhance comment.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r-- | winsup/cygwin/path.cc | 11 |
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. */ |