From 06ca0b67f48839cc682e194512d69324d2965ddc Mon Sep 17 00:00:00 2001 From: kosaki Date: Wed, 16 Sep 2015 03:19:53 +0000 Subject: [PATCH] * 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 --- ChangeLog | 5 +++++ dir.c | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 67b7f59091..f7129956de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Sep 16 12:06:53 2015 KOSAKI Motohiro + + * dir.c (glob_helper): check pathtype once again by lstat(2) if + dp->d_type is DT_UNKNOWN. XFS may return DT_UNKNOWN. + Wed Sep 16 03:49:19 2015 KOSAKI Motohiro * test/ruby/test_thread.rb (TestThread#test_mutex_synchronize): diff --git a/dir.c b/dir.c index aed3ecaa03..178a478d80 100644 --- a/dir.c +++ b/dir.c @@ -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);