diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-09-05 04:30:10 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-09-05 04:30:10 +0000 |
commit | 83185f9181e90979dd698489cefd85514661265e (patch) | |
tree | e5e23b380ecd882baa5986508e9ab75b20dc3647 /dir.c | |
parent | f1df537a831c57021508ac9ca03229550d99b4d8 (diff) | |
download | ruby-83185f9181e90979dd698489cefd85514661265e.tar.gz |
dir.c: fix recursion
* 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/trunk@36905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1171,6 +1171,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); @@ -1181,13 +1182,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) { |