]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: check for openat with dirfd in std::filesystem
authorAlexandre Oliva <oliva@adacore.com>
Mon, 27 Jun 2022 13:34:16 +0000 (10:34 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Mon, 27 Jun 2022 13:34:16 +0000 (10:34 -0300)
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

index c67fe76bc14f8c34c72caa6f9c64ea7a2ae6f0f7..25b33baa875fb417fae34f4b03513b5fd68e9f7b 100644 (file)
@@ -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