summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-17 01:05:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-17 01:05:06 +0000
commit47f4eee420d3aaa4d3ff028dad6e0c249b255467 (patch)
tree1446ed2e4dec6bc1dc854fa2cf5f2350738ddbca /dir.c
parent8cb6f21e1aadad2c1e114a7504425029300edb03 (diff)
dir.c: fix conditions for ALPHA
* dir.c (has_magic): return ALPHA at alphabetical name regardless FNM_CASEFOLD flag. * dir.c (glob_helper): fix conditions for ALPHA. [ruby-core:61552] [Bug #9648] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/dir.c b/dir.c
index 0a7cdbe..0184b18 100644
--- a/dir.c
+++ b/dir.c
@@ -1094,7 +1094,6 @@ static enum glob_pattern_type
has_magic(const char *p, const char *pend, int flags, rb_encoding *enc)
{
const int escape = !(flags & FNM_NOESCAPE);
- const int nocase = flags & FNM_CASEFOLD;
int hasalpha = 0;
register char c;
@@ -1113,7 +1112,7 @@ has_magic(const char *p, const char *pend, int flags, rb_encoding *enc)
default:
if (ISALPHA(c)) {
- if (FNM_SYSCASE || nocase) hasalpha = 1;
+ hasalpha = 1;
}
}
@@ -1350,9 +1349,11 @@ glob_helper(
plain = 1;
break;
case ALPHA:
- case MAGICAL:
magical = 1;
break;
+ case MAGICAL:
+ magical = 2;
+ break;
case MATCH_ALL:
match_all = 1;
break;
@@ -1420,7 +1421,7 @@ glob_helper(
dirp = do_opendir(*path ? path : ".", flags, enc);
if (dirp == NULL) {
# if FNM_SYSCASE || HAVE_HFS
- if (!(magical || recursive) && (errno == EACCES)) {
+ if ((magical < 2) && !recursive && (errno == EACCES)) {
/* no read permission, fallback */
goto literally;
}
@@ -1533,7 +1534,7 @@ glob_helper(
copy_beg = copy_end = GLOB_ALLOC_N(struct glob_pattern *, end - beg);
if (!copy_beg) return -1;
for (cur = beg; cur < end; ++cur)
- *copy_end++ = (*cur)->type == PLAIN ? *cur : 0;
+ *copy_end++ = (*cur)->type <= ALPHA ? *cur : 0;
for (cur = copy_beg; cur < copy_end; ++cur) {
if (*cur) {