mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
dir.c: refresh pathtype when emulating IFTODT
in glob_helper
When using `IFTODT` defined in libc, `dirent.d_type` oriented pathtype
is compatible with `IFTODT(stat.st_mode)`. However they are not
compatible when emulating `IFTODT`, so `glob_helper` has to stat instead
of reusing dirent result by passing unknown pathtype to `glob_helper`.
This is a follow-up fix of 0c90ca4dd0
This commit is contained in:
parent
07acd6006c
commit
44d0caa1ca
Notes:
git
2022-04-03 01:13:50 +09:00
1 changed files with 2 additions and 2 deletions
4
dir.c
4
dir.c
|
@ -2148,7 +2148,7 @@ dirent_copy(const struct dirent *dp, rb_dirent_t *rdp)
|
|||
newrdp->d_altname = dp->d_altname;
|
||||
#endif
|
||||
}
|
||||
#ifdef DT_UNKNOWN
|
||||
#if !EMULATE_IFTODT
|
||||
newrdp->d_type = dp->d_type;
|
||||
#else
|
||||
newrdp->d_type = 0;
|
||||
|
@ -2470,7 +2470,7 @@ glob_helper(
|
|||
break;
|
||||
}
|
||||
name = buf + pathlen + (dirsep != 0);
|
||||
#ifdef DT_UNKNOWN
|
||||
#if !EMULATE_IFTODT
|
||||
if (dp->d_type != DT_UNKNOWN) {
|
||||
/* Got it. We need no more lstat. */
|
||||
new_pathtype = dp->d_type;
|
||||
|
|
Loading…
Add table
Reference in a new issue