diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-16 03:19:53 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-16 03:19:53 +0000 |
commit | 2e6eecc6edffc5c18846752b2730ac670990b74c (patch) | |
tree | b51f10e1d360e1276cc56d24e0af408be29bed34 /dir.c | |
parent | f4a872f8bf45ac8c5f1d54d7e3e40fe579f32170 (diff) | |
download | ruby-2e6eecc6edffc5c18846752b2730ac670990b74c.tar.gz |
* dir.c (glob_helper): check pathtype once again by lstat(2) if
dp->d_type is DT_UNKNOWN. XFS may return DT_UNKNOWN.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -1801,15 +1801,18 @@ glob_helper( } name = buf + pathlen + (dirsep != 0); if (recursive && dotfile < ((flags & FNM_DOTMATCH) ? 2 : 1)) { +#ifdef DT_UNKNOWN + if ((new_pathtype = dp->d_type) != (rb_pathtype_t)DT_UNKNOWN) + /* Got it. We need nothing more. */ + ; + else + /* fall back to call lstat(2) */ +#endif /* RECURSIVE never match dot files unless FNM_DOTMATCH is set */ -#ifndef DT_DIR if (do_lstat(buf, &st, flags, enc) == 0) new_pathtype = IFTODT(st.st_mode); else new_pathtype = path_noent; -#else - new_pathtype = dp->d_type; -#endif } new_beg = new_end = GLOB_ALLOC_N(struct glob_pattern *, (end - beg) * 2); |