summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-03 05:15:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-03 05:15:28 +0000
commit48b19a3a759e85a7dfaad10f8b18e594447fbc36 (patch)
treeaf7ea7dae00410724d2df2ca77a3159a690ac711 /dir.c
parent89e38a2b7ca7a28a4bd8dc61ac88c2f9d853ecd1 (diff)
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
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/dir.c b/dir.c
index 75c5f5f..f28569a 100644
--- a/dir.c
+++ b/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);