ruby-changes:71613
From: Yuta <ko1@a...>
Date: Sun, 3 Apr 2022 01:13:41 +0900 (JST)
Subject: [ruby-changes:71613] 44d0caa1ca (master): dir.c: refresh pathtype when emulating `IFTODT` in `glob_helper`
https://git.ruby-lang.org/ruby.git/commit/?id=44d0caa1ca From 44d0caa1ca56b17bf0ed9e3daf446c1eaacae108 Mon Sep 17 00:00:00 2001 From: Yuta Saito <kateinoigakukun@g...> Date: Thu, 17 Mar 2022 11:05:15 +0000 Subject: 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 0c90ca4dd0abbd28d7bb34b9241d93995ab9cfb7 --- dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dir.c b/dir.c index 8c6d6fea56..a090b9f38c 100644 --- a/dir.c +++ b/dir.c @@ -2148,7 +2148,7 @@ dirent_copy(const struct dirent *dp, rb_dirent_t *rdp) https://github.com/ruby/ruby/blob/trunk/dir.c#L2148 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( https://github.com/ruby/ruby/blob/trunk/dir.c#L2470 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; -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/