On Jun 24, 2022, Jonathan Wakely <jwak...@redhat.com> wrote:

> Ah, but this patch only added the HAVE_OPENAT check to
> src/filesystem/dir.cc not the similar code in src/c++17/fs_dir.cc

Doh!  It was such a long and goof-ful day :-(

Thanks for catching it.

Unless you ask me not to, I'd like to install this to complete the
earlier patch.  I've given it some testing, along with your _At_path
patch, and results are looking promising.  There are still a few
remaining fails.


libstdc++: check for openat with dirfd in std::filesystem

From: Alexandre Oliva <ol...@adacore.com>

In the recent patch to check for openat, I missed an occurrence of
dirfd in std::filesystem.


for  libstdc++-v3/ChangeLog

        * src/c++17/fs_dir.cc (dir_and_pathname): Use dirfd if
        _GLIBCXX_HAVE_OPENAT.
---
 libstdc++-v3/src/c++17/fs_dir.cc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/src/c++17/fs_dir.cc b/libstdc++-v3/src/c++17/fs_dir.cc
index c67fe76bc14f8..25b33baa875fb 100644
--- a/libstdc++-v3/src/c++17/fs_dir.cc
+++ b/libstdc++-v3/src/c++17/fs_dir.cc
@@ -124,7 +124,7 @@ struct fs::_Dir : _Dir_base
   dir_and_pathname() const noexcept
   {
     const fs::path& p = entry.path();
-#if _GLIBCXX_HAVE_DIRFD
+#if _GLIBCXX_HAVE_DIRFD && _GLIBCXX_HAVE_OPENAT
     if (!p.empty())
       return {::dirfd(this->dirp), std::prev(p.end())->c_str()};
 #endif


-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

Reply via email to