1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

FindFirstFile cannot glob share names

* win32/file.c (replace_to_long_name): do not try to glob host
  names and share names by FindFirstFile which is useless for that
  purpose.  [ruby-core:91656] [Bug #15633]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2019-03-04 08:13:25 +00:00
parent e4885d8acc
commit 958798851d

View file

@ -189,6 +189,20 @@ replace_to_long_name(wchar_t **wfullpath, size_t size, size_t buffer_size)
pos--;
}
if ((pos >= *wfullpath + 2) &&
(*wfullpath)[0] == L'\\' && (*wfullpath)[1] == L'\\') {
/* UNC path: no short file name, and needs Network Share
* Management functions instead of FindFirstFile. */
if (pos == *wfullpath + 2) {
/* //host only */
return size;
}
if (!wmemchr(*wfullpath + 2, L'\\', pos - *wfullpath - 2)) {
/* //host/share only */
return size;
}
}
find_handle = FindFirstFileW(*wfullpath, &find_data);
if (find_handle != INVALID_HANDLE_VALUE) {
size_t trail_pos = pos - *wfullpath + IS_DIR_SEPARATOR_P(*pos);