diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2020-10-08 14:04:31 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2020-10-08 14:04:31 +0300 |
commit | 04826c2e67404ec63782a0025b929c7d717ea1fd (patch) | |
tree | b52837073da8c390ead9ef0e8399da17f245bc47 /include/llfio/v2.0/path_handle.hpp | |
parent | e8f25ff3646124c4090a3413bfb43751b680a3ff (diff) |
Long, long round of refactoring path_view to match latest P1030 draft normative wording. Not done yet however, so this is a wip commit.
Diffstat (limited to 'include/llfio/v2.0/path_handle.hpp')
-rw-r--r-- | include/llfio/v2.0/path_handle.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/llfio/v2.0/path_handle.hpp b/include/llfio/v2.0/path_handle.hpp index a931bd42..e1df68d5 100644 --- a/include/llfio/v2.0/path_handle.hpp +++ b/include/llfio/v2.0/path_handle.hpp @@ -107,6 +107,17 @@ public: return path_handle(std::move(newh)); } + /*! Returns whether a file entry exists more efficiently that opening and + closing a `file_handle`. Note that this can be a rich source of TOCTOU + security attacks! Be aware that symbolic links are NOT dereferenced, so + a subsequent file handle open may fail. + */ + LLFIO_MAKE_FREE_FUNCTION + result<bool> exists(path_view_type path) const noexcept; + //! \overload + LLFIO_MAKE_FREE_FUNCTION + static inline result<bool> exists(const path_handle &base, path_view_type path) noexcept { return base.exists(path); } + /*! Create a path handle opening access to some location on the filing system. Some operating systems provide a particularly lightweight method of doing this (Linux: `O_PATH`, Windows: no access perms) which is much faster than opening |