diff options
| author | Ryan Liptak <squeek502@hotmail.com> | 2022-07-25 06:14:25 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-25 16:14:25 +0300 |
| commit | 75e5b38410e81ddf21ba37a874ee2bb13dea7477 (patch) | |
| tree | 86bc98c9bf81d13ca30e676e533d58c956196b72 /src/Compilation.zig | |
| parent | 8f3ab96b0e8cd22dc98f9fe352c5d4fff491dd0e (diff) | |
| download | zig-75e5b38410e81ddf21ba37a874ee2bb13dea7477.tar.gz zig-75e5b38410e81ddf21ba37a874ee2bb13dea7477.zip | |
std.fs: End iteration on Linux/WASI during Iterator.next when hitting `ENOENT`
`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
Diffstat (limited to 'src/Compilation.zig')
0 files changed, 0 insertions, 0 deletions
