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

ruby-changes:22156

From: usa <ko1@a...>
Date: Wed, 4 Jan 2012 11:33:51 +0900 (JST)
Subject: [ruby-changes:22156] usa:r34205 (trunk): * win32/win32.c (check_valid_dir): special case for a root directory.

usa	2012-01-04 11:33:37 +0900 (Wed, 04 Jan 2012)

  New Revision: 34205

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34205

  Log:
    * win32/win32.c (check_valid_dir): special case for a root directory.
      Reported by Masateru OKAMOTO at [Bug #5819].

  Modified files:
    trunk/ChangeLog
    trunk/win32/win32.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 34204)
+++ ChangeLog	(revision 34205)
@@ -1,3 +1,8 @@
+Wed Jan  4 11:32:07 2012  NAKAMURA Usaku  <usa@r...>
+
+	* win32/win32.c (check_valid_dir): special case for a root directory.
+	  Reported by Masateru OKAMOTO at [Bug #5819].
+
 Wed Jan  4 00:19:54 2012  Kouhei Sutou  <kou@c...>
 
 	* lib/rexml/parsers/baseparser.rb: use private instead of _xxx
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 34204)
+++ win32/win32.c	(revision 34205)
@@ -4475,7 +4475,20 @@
 check_valid_dir(const WCHAR *path)
 {
     WIN32_FIND_DATAW fd;
-    HANDLE fh = open_dir_handle(path, &fd);
+    HANDLE fh;
+    WCHAR full[MAX_PATH];
+    WCHAR *dmy;
+
+    /* if the specified path is the root of a drive and the drive is empty, */
+    /* FindFirstFile() returns INVALID_HANDLE_VALUE. */
+    if (!GetFullPathNameW(path, sizeof(full) / sizeof(WCHAR), full, &dmy)) {
+	errno = map_errno(GetLastError());
+	return -1;
+    }
+    if (GetDriveTypeW(full) != DRIVE_NO_ROOT_DIR)
+	return 0;
+
+    fh = open_dir_handle(path, &fd);
     if (fh == INVALID_HANDLE_VALUE)
 	return -1;
     FindClose(fh);

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

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