[前][次][番号順一覧][スレッド一覧]

ruby-changes:54957

From: nobu <ko1@a...>
Date: Mon, 4 Mar 2019 17:13:32 +0900 (JST)
Subject: [ruby-changes:54957] nobu:r67163 (trunk): FindFirstFile cannot glob share names

nobu	2019-03-04 17:13:25 +0900 (Mon, 04 Mar 2019)

  New Revision: 67163

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67163

  Log:
    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]

  Modified files:
    trunk/win32/file.c
Index: win32/file.c
===================================================================
--- win32/file.c	(revision 67162)
+++ win32/file.c	(revision 67163)
@@ -189,6 +189,20 @@ replace_to_long_name(wchar_t **wfullpath https://github.com/ruby/ruby/blob/trunk/win32/file.c#L189
 	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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]