Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-04-15 13:58:41 +0400
committerCorinna Vinschen <corinna@vinschen.de>2009-04-15 13:58:41 +0400
commitca027229d52d91c8a460b873bd2b454299369fad (patch)
tree4857f9e67d4a95f0accd9a434f94362307c61445 /winsup/cygwin/path.cc
parentd370bb56c85a0e098a72841703ff87531820156b (diff)
* path.cc (path_conv::get_wide_win32_path): Allow relative paths.
(cygwin_conv_path): In case of CCP_POSIX_TO_WIN_W, convert relative paths to absolute paths if the relative pathname length exceeds MAX_PATH.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc23
1 files changed, 17 insertions, 6 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 576f9cdf4..e39a4b2fb 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -494,10 +494,11 @@ PWCHAR
path_conv::get_wide_win32_path (PWCHAR wc)
{
get_nt_native_path ();
- if (!wide_path || wide_path[1] != L'?') /* Native NT device path */
+ if (!wide_path)
return NULL;
- wcscpy (wc, wide_path);
- wc[1] = L'\\';
+ wcpcpy (wc, wide_path);
+ if (wc[1] == L'?')
+ wc[1] = L'\\';
return wc;
}
@@ -2660,11 +2661,21 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
}
break;
case CCP_POSIX_TO_WIN_W:
- p.check ((const char *) from,
- PC_POSIX | PC_SYM_FOLLOW | PC_NO_ACCESS_CHECK | PC_NOWARN
- | (relative ? PC_NOFULL : 0));
+ p.check ((const char *) from, PC_POSIX | PC_SYM_FOLLOW
+ | PC_NO_ACCESS_CHECK | PC_NOWARN
+ | (relative ? PC_NOFULL : 0));
if (p.error)
return_with_errno (p.error);
+ /* Relative Windows paths are always restricted to MAX_PATH chars. */
+ if (relative && !isabspath (p.get_win32 ())
+ && sys_mbstowcs (NULL, 0, p.get_win32 ()) > MAX_PATH)
+ {
+ /* Recreate as absolute path. */
+ p.check ((const char *) from, PC_POSIX | PC_SYM_FOLLOW
+ | PC_NO_ACCESS_CHECK | PC_NOWARN);
+ if (p.error)
+ return_with_errno (p.error);
+ }
lsiz = (p.get_wide_win32_path_len () + 1) * sizeof (WCHAR);
break;
case CCP_WIN_A_TO_POSIX: