summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-06 05:06:20 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-06 05:06:20 +0000
commit10d2b5ec466d321ab7e4662088c9e2d285266c04 (patch)
treee5ccea3c1db97484de69a4631053d1709c523f4b /dir.c
parent34a542cb70a59a40f5819dbb9d73e744d1bb5b2f (diff)
merge revision(s) 36905: [Backport #6977]
* dir.c (glob_make_pattern): names under recursive need to be single basenames to match for each name. [ruby-core:47418] [Bug #6977] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@39090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/dir.c b/dir.c
index 387a2490b6..4246b10c9d 100644
--- a/dir.c
+++ b/dir.c
@@ -1175,6 +1175,7 @@ glob_make_pattern(const char *p, const char *e, int flags, rb_encoding *enc)
{
struct glob_pattern *list, *tmp, **tail = &list;
int dirsep = 0; /* pattern is terminated with '/' */
+ int recursive = 0;
while (p < e && *p) {
tmp = GLOB_ALLOC(struct glob_pattern);
@@ -1185,13 +1186,14 @@ glob_make_pattern(const char *p, const char *e, int flags, rb_encoding *enc)
tmp->type = RECURSIVE;
tmp->str = 0;
dirsep = 1;
+ recursive = 1;
}
else {
const char *m = find_dirsep(p, e, flags, enc);
int magic = has_magic(p, m, flags, enc);
char *buf;
- if (!magic && *m) {
+ if (!magic && !recursive && *m) {
const char *m2;
while (!has_magic(m+1, m2 = find_dirsep(m+1, e, flags, enc), flags, enc) &&
*m2) {