1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:17:45 +00:00

LibCore: Allow moving, but not copying, DirIterator

An explicit move constructor is required to null-out the moved-from
directory descriptor. Otherwise, we would call closedir() twice when
using ErrorOr<DirIterator>::release_value().
This commit is contained in:
Timothy Flynn 2021-11-23 11:37:14 -05:00 committed by Andreas Kling
parent 55e0b91d8d
commit 7f780e43a6
2 changed files with 13 additions and 0 deletions

View file

@ -23,6 +23,9 @@ public:
explicit DirIterator(String path, Flags = Flags::NoFlags);
~DirIterator();
DirIterator(DirIterator&&);
DirIterator(DirIterator const&) = delete;
bool has_error() const { return m_error != 0; }
int error() const { return m_error; }
const char* error_string() const { return strerror(m_error); }