aboutsummaryrefslogtreecommitdiffstats
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-18 07:20:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-18 07:20:53 +0000
commita4188556d3735aec2fba15372f73826c16d1af05 (patch)
tree6753c1faf0de8a92fac564bf580dbfbbb61d7657 /dir.c
parentc3db44dc35a0ea43a0a79c487b852b200aed73ae (diff)
downloadruby-a4188556d3735aec2fba15372f73826c16d1af05.tar.gz
dir.c: not skip dot directories if matching
* dir.c (glob_helper): should skip dot directories only for recursion, but should not if matching to the given pattern. [ruby-core:54387] [Bug #8283] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/dir.c b/dir.c
index 567a88c29f..00bac4df90 100644
--- a/dir.c
+++ b/dir.c
@@ -1434,9 +1434,6 @@ glob_helper(
IF_HAVE_HFS(VALUE utf8str = Qnil);
if (recursive && dp->d_name[0] == '.') {
- /* RECURSIVE never match dot files unless FNM_DOTMATCH is set */
- if (!(flags & FNM_DOTMATCH)) continue;
-
/* always skip current and parent directories not to recurse infinitely */
if (!dp->d_name[1]) continue;
if (dp->d_name[1] == '.' && !dp->d_name[2]) continue;
@@ -1461,7 +1458,8 @@ glob_helper(
break;
}
name = buf + pathlen + (dirsep != 0);
- if (recursive) {
+ if (recursive && ((flags & FNM_DOTMATCH) || dp->d_name[0] != '.')) {
+ /* RECURSIVE never match dot files unless FNM_DOTMATCH is set */
#ifndef _WIN32
if (do_lstat(buf, &st, flags) == 0)
new_isdir = S_ISDIR(st.st_mode) ? YES : S_ISLNK(st.st_mode) ? UNKNOWN : NO;