diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-06-27 14:43:54 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-06-28 12:09:20 +0100 |
commit | 198781144f33b0ef17dd2094580b5c77ad97d6e8 (patch) | |
tree | ea71d88cfa12271bebe5437f606e0981dc0cdaa3 /libphobos/libdruntime/gcc | |
parent | 835b19936bf30d693783bfa39145a4ce243bbd7c (diff) | |
download | gcc-198781144f33b0ef17dd2094580b5c77ad97d6e8.zip gcc-198781144f33b0ef17dd2094580b5c77ad97d6e8.tar.gz gcc-198781144f33b0ef17dd2094580b5c77ad97d6e8.tar.bz2 |
libstdc++: Improve directory iterator abstractions for openat
Currently the _Dir::open_subdir function decides whether to construct a
_Dir_base with just a pathname, or a file descriptor and pathname. But
that means it is tiughtly coupled to the implementation of
_Dir_base::openat, which is what actually decides whether to use a file
descriptor or not. If the derived class passes a file descriptor and
filename, but the base class expects a full path and ignores the file
descriptor, then recursive_directory_iterator cannot recurse.
This change introduces a new type that provides the union of all the
information available to the derived class (the full pathname, as well
as a file descriptor for a directory and another pathname relative to
that directory). This allows the derived class to be agnostic to how the
base class will use that information.
libstdc++-v3/ChangeLog:
* src/c++17/fs_dir.cc (_Dir::dir_and_pathname):: Replace with
current() returning _At_path.
(_Dir::_Dir, _Dir::open_subdir, _Dir::do_unlink): Adjust.
* src/filesystem/dir-common.h (_Dir_base::_At_path): New class.
(_Dir_base::_Dir_Base, _Dir_base::openat): Use _At_path.
* src/filesystem/dir.cc (_Dir::dir_and_pathname): Replace with
current() returning _At_path.
(_Dir::_Dir, _Dir::open_subdir): Adjust.
Diffstat (limited to 'libphobos/libdruntime/gcc')
0 files changed, 0 insertions, 0 deletions