mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
dir.c: getattrlist on OSX 10.5
* dir.c (is_case_sensitive): use getattrlist() if fgetattrlist() is unavailable, on OSX 10.5. [ruby-core:68829] [Bug #11054] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c2ebf056ef
commit
1c80c388d5
1 changed files with 12 additions and 2 deletions
14
dir.c
14
dir.c
|
@ -1516,8 +1516,13 @@ join_path(const char *path, long len, int dirsep, const char *name, size_t namle
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GETATTRLIST
|
#ifdef HAVE_GETATTRLIST
|
||||||
|
# if defined HAVE_FGETATTRLIST
|
||||||
|
# define is_case_sensitive(dirp, path) is_case_sensitive(dirp)
|
||||||
|
# else
|
||||||
|
# define is_case_sensitive(dirp, path) is_case_sensitive(path)
|
||||||
|
# endif
|
||||||
static int
|
static int
|
||||||
is_case_sensitive(DIR *dirp)
|
is_case_sensitive(DIR *dirp, const char *path)
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
u_int32_t length;
|
u_int32_t length;
|
||||||
|
@ -1528,8 +1533,13 @@ is_case_sensitive(DIR *dirp)
|
||||||
const int idx = VOL_CAPABILITIES_FORMAT;
|
const int idx = VOL_CAPABILITIES_FORMAT;
|
||||||
const uint32_t mask = VOL_CAP_FMT_CASE_SENSITIVE;
|
const uint32_t mask = VOL_CAP_FMT_CASE_SENSITIVE;
|
||||||
|
|
||||||
|
# if defined HAVE_FGETATTRLIST
|
||||||
if (fgetattrlist(dirfd(dirp), &al, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW))
|
if (fgetattrlist(dirfd(dirp), &al, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW))
|
||||||
return -1;
|
return -1;
|
||||||
|
# else
|
||||||
|
if (getattrlist(path, &al, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW))
|
||||||
|
return -1;
|
||||||
|
# endif
|
||||||
if (!(cap->valid[idx] & mask))
|
if (!(cap->valid[idx] & mask))
|
||||||
return -1;
|
return -1;
|
||||||
return (cap->capabilities[idx] & mask) != 0;
|
return (cap->capabilities[idx] & mask) != 0;
|
||||||
|
@ -1824,7 +1834,7 @@ glob_helper(
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# ifdef HAVE_GETATTRLIST
|
# ifdef HAVE_GETATTRLIST
|
||||||
if (is_case_sensitive(dirp) == 0)
|
if (is_case_sensitive(dirp, path) == 0)
|
||||||
flags |= FNM_CASEFOLD;
|
flags |= FNM_CASEFOLD;
|
||||||
# endif
|
# endif
|
||||||
while ((dp = READDIR(dirp, enc)) != NULL) {
|
while ((dp = READDIR(dirp, enc)) != NULL) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue