* mount.cc (is_unc_share): Allow \\?\ prefix as well. Enhance comment.
(mount_info::from_fstab): Remove patch from 2008-04-29. * mount.cc (mount_info::conv_to_posix_path): Simplify test for native UNC path. * path.cc (normalize_win32_path): Ditto. (symlink_worker): Ditto. (symlink_info::posixify): Ditto. (cygwin_conv_path): Ditto.
This commit is contained in:
parent
f77a1a8848
commit
7e2b8e7d2a
@ -1,3 +1,15 @@
|
|||||||
|
2008-04-30 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* mount.cc (is_unc_share): Allow \\?\ prefix as well. Enhance comment.
|
||||||
|
(mount_info::from_fstab): Remove patch from 2008-04-29.
|
||||||
|
|
||||||
|
* mount.cc (mount_info::conv_to_posix_path): Simplify test for native
|
||||||
|
UNC path.
|
||||||
|
* path.cc (normalize_win32_path): Ditto.
|
||||||
|
(symlink_worker): Ditto.
|
||||||
|
(symlink_info::posixify): Ditto.
|
||||||
|
(cygwin_conv_path): Ditto.
|
||||||
|
|
||||||
2008-04-29 Corinna Vinschen <corinna@vinschen.de>
|
2008-04-29 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* mount.cc (mount_info::from_fstab): Skip native path prefix in
|
* mount.cc (mount_info::from_fstab): Skip native path prefix in
|
||||||
|
@ -42,7 +42,10 @@ details. */
|
|||||||
#define isproc(path) \
|
#define isproc(path) \
|
||||||
(path_prefix_p (proc, (path), proc_len))
|
(path_prefix_p (proc, (path), proc_len))
|
||||||
|
|
||||||
/* is_unc_share: Return non-zero if PATH begins with //UNC/SHARE */
|
/* is_unc_share: Return non-zero if PATH begins with //server/share
|
||||||
|
or with one of the native prefixes //./ or //?/
|
||||||
|
This function is only used to test for valid input strings.
|
||||||
|
The later normalization drops the native prefixes. */
|
||||||
|
|
||||||
static inline bool __stdcall
|
static inline bool __stdcall
|
||||||
is_unc_share (const char *path)
|
is_unc_share (const char *path)
|
||||||
@ -50,7 +53,7 @@ is_unc_share (const char *path)
|
|||||||
const char *p;
|
const char *p;
|
||||||
return (isdirsep (path[0])
|
return (isdirsep (path[0])
|
||||||
&& isdirsep (path[1])
|
&& isdirsep (path[1])
|
||||||
&& (isalnum (path[2]) || path[2] == '.')
|
&& (isalnum (path[2]) || path[2] == '.' || path[2] == '?')
|
||||||
&& ((p = strpbrk (path + 3, "\\/")) != NULL)
|
&& ((p = strpbrk (path + 3, "\\/")) != NULL)
|
||||||
&& isalnum (p[1]));
|
&& isalnum (p[1]));
|
||||||
}
|
}
|
||||||
@ -576,10 +579,9 @@ mount_info::conv_to_posix_path (PWCHAR src_path, char *posix_path,
|
|||||||
if (!wcsncmp (src_path, L"\\\\?\\", 4))
|
if (!wcsncmp (src_path, L"\\\\?\\", 4))
|
||||||
{
|
{
|
||||||
src_path += 4;
|
src_path += 4;
|
||||||
if (!wcsncmp (src_path, L"UNC\\", 4))
|
if (src_path[1] != L':') /* native UNC path */
|
||||||
{
|
{
|
||||||
src_path += 2;
|
*(src_path += 2) = L'\\';
|
||||||
src_path[0] = L'\\';
|
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -881,12 +883,6 @@ mount_info::from_fstab (bool user)
|
|||||||
debug_printf ("GetModuleFileNameW, %E");
|
debug_printf ("GetModuleFileNameW, %E");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!wcsncmp (path, L"\\\\?\\", 4))
|
|
||||||
{
|
|
||||||
path += 4;
|
|
||||||
if (path[1] != L':')
|
|
||||||
*(path += 2) = L'\\';
|
|
||||||
}
|
|
||||||
w = wcsrchr (path, L'\\');
|
w = wcsrchr (path, L'\\');
|
||||||
if (w)
|
if (w)
|
||||||
{
|
{
|
||||||
|
@ -1353,7 +1353,7 @@ normalize_win32_path (const char *src, char *dst, char *&tail)
|
|||||||
&& src[2] == '?' && isdirsep (src[3]))
|
&& src[2] == '?' && isdirsep (src[3]))
|
||||||
{
|
{
|
||||||
src += 4;
|
src += 4;
|
||||||
if (ascii_strncasematch (src, "UNC", 3))
|
if (src[1] != ':') /* native UNC path */
|
||||||
{
|
{
|
||||||
src += 2; /* Fortunately the first char is not copied... */
|
src += 2; /* Fortunately the first char is not copied... */
|
||||||
beg_src_slash = true;
|
beg_src_slash = true;
|
||||||
@ -1643,10 +1643,9 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
|
|||||||
takes a wide char path name, it does not understand the
|
takes a wide char path name, it does not understand the
|
||||||
Win32 prefix for long pathnames! So we have to tack off
|
Win32 prefix for long pathnames! So we have to tack off
|
||||||
the prefix and convert the path to the "normal" syntax
|
the prefix and convert the path to the "normal" syntax
|
||||||
for ParseDisplayName. I have no idea if it's able to take
|
for ParseDisplayName. */
|
||||||
long path names at all since I can't test it right now. */
|
|
||||||
WCHAR *wc = wc_path + 4;
|
WCHAR *wc = wc_path + 4;
|
||||||
if (!wcsncmp (wc, L"UNC\\", 4))
|
if (wc[1] != L':') /* native UNC path */
|
||||||
*(wc += 2) = L'\\';
|
*(wc += 2) = L'\\';
|
||||||
HRESULT res;
|
HRESULT res;
|
||||||
if (SUCCEEDED (res = psl->ParseDisplayName (NULL, NULL, wc, NULL,
|
if (SUCCEEDED (res = psl->ParseDisplayName (NULL, NULL, wc, NULL,
|
||||||
@ -2013,11 +2012,8 @@ symlink_info::posixify (char *srcbuf)
|
|||||||
if (srcbuf[0] == '\\' && !strncmp (srcbuf + 1, "??\\", 3))
|
if (srcbuf[0] == '\\' && !strncmp (srcbuf + 1, "??\\", 3))
|
||||||
{
|
{
|
||||||
srcbuf += 4;
|
srcbuf += 4;
|
||||||
if (!strncmp (srcbuf, "UNC\\", 4))
|
if (srcbuf[1] != ':') /* native UNC path */
|
||||||
{
|
*(srcbuf += 2) = '\\';
|
||||||
srcbuf += 2;
|
|
||||||
*srcbuf = '\\';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (isdrive (srcbuf))
|
if (isdrive (srcbuf))
|
||||||
mount_table->conv_to_posix_path (srcbuf, contents, 0);
|
mount_table->conv_to_posix_path (srcbuf, contents, 0);
|
||||||
@ -2729,7 +2725,7 @@ cygwin_conv_path (cygwin_conv_path_t what, const void *from, void *to,
|
|||||||
buf = tp.c_get ();
|
buf = tp.c_get ();
|
||||||
sys_wcstombs (buf, NT_MAX_PATH, up->Buffer, up->Length / sizeof (WCHAR));
|
sys_wcstombs (buf, NT_MAX_PATH, up->Buffer, up->Length / sizeof (WCHAR));
|
||||||
buf += 4; /* Skip \??\ */
|
buf += 4; /* Skip \??\ */
|
||||||
if (ascii_strncasematch (buf, "UNC\\", 4))
|
if (buf[1] != ':') /* native UNC path */
|
||||||
*(buf += 2) = '\\';
|
*(buf += 2) = '\\';
|
||||||
lsiz = strlen (buf) + 1;
|
lsiz = strlen (buf) + 1;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user