mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
dir.c: get rid of FindFirstFile bug
* dir.c (do_stat): use rb_w32_ustati64() in win32.c to get rid of mysterious behavior of FindFirstFile() Windows API which treat "<" and ">" like as wildcard characters. [ruby-core:55764] [Bug #8597] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
89e38a2b7c
commit
48b19a3a75
3 changed files with 17 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
Wed Jul 3 14:15:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* dir.c (do_stat): use rb_w32_ustati64() in win32.c to get rid of
|
||||
mysterious behavior of FindFirstFile() Windows API which treat "<"
|
||||
and ">" like as wildcard characters. [ruby-core:55764] [Bug #8597]
|
||||
|
||||
Wed Jul 3 12:06:42 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* bignum.c (maxpow_in_bdigit): Renamed from calc_hbase and return
|
||||
|
|
8
dir.c
8
dir.c
|
@ -1029,12 +1029,18 @@ sys_warning_1(VALUE mesg)
|
|||
*/
|
||||
#define to_be_ignored(e) ((e) == ENOENT || (e) == ENOTDIR)
|
||||
|
||||
#ifdef _WIN32
|
||||
#define STAT(p, s) rb_w32_ustati64((p), (s))
|
||||
#else
|
||||
#define STAT(p, s) stat((p), (s))
|
||||
#endif
|
||||
|
||||
/* System call with warning */
|
||||
static int
|
||||
do_stat(const char *path, struct stat *pst, int flags)
|
||||
|
||||
{
|
||||
int ret = stat(path, pst);
|
||||
int ret = STAT(path, pst);
|
||||
if (ret < 0 && !to_be_ignored(errno))
|
||||
sys_warning(path);
|
||||
|
||||
|
|
|
@ -213,4 +213,8 @@ class TestDir < Test::Unit::TestCase
|
|||
Dir.glob(File.join(@root, "**/"))
|
||||
end
|
||||
|
||||
def test_glob_metachar
|
||||
bug8597 = '[ruby-core:55764] [Bug #8597]'
|
||||
assert_empty(Dir.glob(File.join(@root, "<")), bug8597)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue