LibCore: Don't record false DirIterator errors

`readdir()` returns null if there is an error, OR if we reached the end.
We don't need to create an Error if there wasn't one.
This commit is contained in:
Sam Atkins 2023-03-17 16:04:19 +00:00 committed by Andrew Kaster
parent cec8543097
commit 6bcde0dcf4
Notes: sideshowbarker 2024-07-17 00:49:59 +09:00

View file

@ -48,7 +48,10 @@ bool DirIterator::advance_next()
errno = 0;
auto* de = readdir(m_dir);
if (!de) {
m_error = Error::from_errno(errno);
if (errno != 0) {
m_error = Error::from_errno(errno);
dbgln("DirIteration error: {}", m_error.value());
}
m_next.clear();
return false;
}