mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
8cb6f21e1a
commit
47f4eee420
2 changed files with 14 additions and 5 deletions
|
@ -1,3 +1,11 @@
|
|||
Sat May 17 10:05:05 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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]
|
||||
|
||||
Sat May 17 01:49:27 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* dir.c (glob_helper): reduce matching at non-mgaical path on
|
||||
|
|
11
dir.c
11
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) {
|
||||
|
|
Loading…
Reference in a new issue