aboutsummaryrefslogtreecommitdiffstats
path: root/win32
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-04 08:13:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-03-04 08:13:25 +0000
commit958798851d24a70e849e19592a36edce2daf18d1 (patch)
tree76b4bc75404678551e63a023e123e128e5318e94 /win32
parente4885d8accb0a30069374ee21f688631fca45f62 (diff)
downloadruby-958798851d24a70e849e19592a36edce2daf18d1.tar.gz
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
Diffstat (limited to 'win32')
-rw-r--r--win32/file.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/win32/file.c b/win32/file.c
index 446720c2f7..275520215a 100644
--- a/win32/file.c
+++ b/win32/file.c
@@ -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);