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

* win32/win32.c (check_valid_dir): special case for a root directory.

Reported by Masateru OKAMOTO at [Bug #5819].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2012-01-04 02:33:37 +00:00
parent bd895ab176
commit 79e0379a75
2 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Wed Jan 4 11:32:07 2012 NAKAMURA Usaku <usa@ruby-lang.org>
* 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@cozmixng.org>
* lib/rexml/parsers/baseparser.rb: use private instead of _xxx

View file

@ -4475,7 +4475,20 @@ static int
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);