* 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.
This commit is contained in:
parent
d370bb56c8
commit
ca027229d5
@ -1,3 +1,10 @@
|
|||||||
|
2009-04-15 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2009-04-15 Corinna Vinschen <corinna@vinschen.de>
|
2009-04-15 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* libc/bsdlib.cc: Align copyright with upstream.
|
* libc/bsdlib.cc: Align copyright with upstream.
|
||||||
|
@ -494,10 +494,11 @@ PWCHAR
|
|||||||
path_conv::get_wide_win32_path (PWCHAR wc)
|
path_conv::get_wide_win32_path (PWCHAR wc)
|
||||||
{
|
{
|
||||||
get_nt_native_path ();
|
get_nt_native_path ();
|
||||||
if (!wide_path || wide_path[1] != L'?') /* Native NT device path */
|
if (!wide_path)
|
||||||
return NULL;
|
return NULL;
|
||||||
wcscpy (wc, wide_path);
|
wcpcpy (wc, wide_path);
|
||||||
wc[1] = L'\\';
|
if (wc[1] == L'?')
|
||||||
|
wc[1] = L'\\';
|
||||||
return wc;
|
return wc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2660,11 +2661,21 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CCP_POSIX_TO_WIN_W:
|
case CCP_POSIX_TO_WIN_W:
|
||||||
p.check ((const char *) from,
|
p.check ((const char *) from, PC_POSIX | PC_SYM_FOLLOW
|
||||||
PC_POSIX | PC_SYM_FOLLOW | PC_NO_ACCESS_CHECK | PC_NOWARN
|
| PC_NO_ACCESS_CHECK | PC_NOWARN
|
||||||
| (relative ? PC_NOFULL : 0));
|
| (relative ? PC_NOFULL : 0));
|
||||||
if (p.error)
|
if (p.error)
|
||||||
return_with_errno (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);
|
lsiz = (p.get_wide_win32_path_len () + 1) * sizeof (WCHAR);
|
||||||
break;
|
break;
|
||||||
case CCP_WIN_A_TO_POSIX:
|
case CCP_WIN_A_TO_POSIX:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user