summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2016-05-31 16:33:21 +0200
committerCorinna Vinschen <corinna@vinschen.de>2016-05-31 16:33:21 +0200
commit5c759ab2f45f966b5458d49a1a0e23c15d5c1eca (patch)
tree294c72f30d670c4af94d914cd18973bf25290d70
parent357da5bc324311eca1b394ade519f7a681fd483f (diff)
downloadcygnal-5c759ab2f45f966b5458d49a1a0e23c15d5c1eca.tar.gz
cygnal-5c759ab2f45f966b5458d49a1a0e23c15d5c1eca.tar.bz2
cygnal-5c759ab2f45f966b5458d49a1a0e23c15d5c1eca.zip
realpath: Handle Win32 and NT long path prefixes
So far drive letter paths have been handled special since path_conv leaves the incoming path untouched except for converting backslashes to forward slashes. However, if the incoming path starts with a long path prefix, the same problem occurs. Therefore handle all paths starting with a backslahs the same way. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r--winsup/cygwin/path.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 250871df0..18d5c1dfa 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3560,10 +3560,12 @@ realpath (const char *__restrict path, char *__restrict resolved)
potentially invalid resolved. */
__try
{
- /* Win32 drive letter paths have to be converted to a POSIX path first,
- because path_conv leaves the incoming path untouched except for
- converting backslashes to forward slashes. */
- if (isdrive (path))
+ /* Win32 drive letter paths and, generally, any path starting with a
+ backslash, have to be converted to a POSIX path first, because
+ path_conv leaves the incoming path untouched except for converting
+ backslashes to forward slashes. This also covers '\\?\ and '\??\'
+ path prefixes. */
+ if (isdrive (path) || path[0] == '\\')
{
tpath = tp.c_get ();
mount_table->conv_to_posix_path (path, tpath, 0);