summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-07-15 13:27:34 +0000
committerCorinna Vinschen <corinna@vinschen.de>2009-07-15 13:27:34 +0000
commitb31ca33dcc637b974661413183661d6851c70c90 (patch)
treec634abd417f98a3bed843475088e3647e696c7c0 /winsup/cygwin/path.cc
parent5aa96db90566600f2d588e45f5e4e031db686727 (diff)
downloadcygnal-b31ca33dcc637b974661413183661d6851c70c90.tar.gz
cygnal-b31ca33dcc637b974661413183661d6851c70c90.tar.bz2
cygnal-b31ca33dcc637b974661413183661d6851c70c90.zip
* path.cc (cwdstuff::set): Only fix up UNC path in win32 so as not
to overwrite incoming path.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index b8be19f2e..20d750303 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -3195,6 +3195,8 @@ cwdstuff::set (PUNICODE_STRING nat_cwd, const char *posix_cwd, bool doit)
}
else
{
+ bool unc = false;
+
if (upath.Buffer[0] == L'/') /* Virtual path, don't mangle. */
;
else if (!doit)
@@ -3202,7 +3204,7 @@ cwdstuff::set (PUNICODE_STRING nat_cwd, const char *posix_cwd, bool doit)
/* Convert to a Win32 path. */
upath.Buffer += upath.Length / sizeof (WCHAR) - len;
if (upath.Buffer[1] == L'\\') /* UNC path */
- upath.Buffer[0] = L'\\';
+ unc = true;
upath.Length = len * sizeof (WCHAR);
}
else
@@ -3218,6 +3220,8 @@ cwdstuff::set (PUNICODE_STRING nat_cwd, const char *posix_cwd, bool doit)
upath.Length + 2),
upath.Length + 2);
RtlCopyUnicodeString (&win32, &upath);
+ if (unc)
+ win32.Buffer[0] = L'\\';
}
/* Make sure it's NUL-terminated. */
win32.Buffer[win32.Length / sizeof (WCHAR)] = L'\0';