mirror of
https://github.com/ziglang/zig.git
synced 2025-12-07 23:03:08 +00:00
`getdents` on Linux can return `ENOENT` if the directory referred to by the fd is deleted during iteration. Returning null when this happens makes sense because: - `ENOENT` is specific to the Linux implementation of `getdents` - On other platforms like FreeBSD, `getdents` returns `0` in this scenario, which is functionally equivalent to the `.NOENT => return null` handling on Linux - In all the usage sites of `Iterator.next` throughout the standard library, translating `ENOENT` returned from `next` as null was the best way to handle it, so the use-case for handling the exact `ENOENT` scenario specifically may not exist to a relevant extent Previously, ENOENT being returned would trigger `os.unexpectedErrno`. Closes #12211