]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Do not optimize away storing pathname if it's needed
authorJonathan Wakely <jwakely@redhat.com>
Tue, 28 Jun 2022 08:26:12 +0000 (09:26 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 4 Oct 2023 11:10:05 +0000 (12:10 +0100)
libstdc++-v3/ChangeLog:

* src/c++17/fs_dir.cc (_Dir::_Dir) [!_GLIBCXX_HAVE_OPENAT]:
Always store pathname if we don't have openat or unlinkat,
because the full path is needed to open sub-directories and
remove entries.

(cherry picked from commit 835b19936bf30d693783bfa39145a4ce243bbd7c)

libstdc++-v3/src/c++17/fs_dir.cc

index a7a22a7134c45fc02f1e40d7360c065ce1d1e4a9..39d12ec130a9f77172931b08617fb4fe713a2097 100644 (file)
@@ -48,7 +48,7 @@ struct fs::_Dir : _Dir_base
        [[maybe_unused]] bool filename_only, error_code& ec)
   : _Dir_base(fdcwd(), p.c_str(), skip_permission_denied, nofollow, ec)
   {
-#if _GLIBCXX_HAVE_DIRFD
+#if _GLIBCXX_HAVE_DIRFD && _GLIBCXX_HAVE_OPENAT && _GLIBCXX_HAVE_UNLINKAT
     if (filename_only)
       return; // Do not store path p when we aren't going to use it.
 #endif