* path.cc (symlink_native): Fix common prefix search. Enhance comment.

This commit is contained in:
Corinna Vinschen 2013-07-15 09:57:20 +00:00
parent a18c8c3688
commit 7556523159
2 changed files with 10 additions and 5 deletions

View File

@ -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.

View File

@ -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. */