mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
Directory iteration: handle EACCES returned from getdents64
This can occur for directories that the user does not have the necessary permissions to be able to iterate.
This commit is contained in:
parent
2f188290e2
commit
7555085e63
@ -662,6 +662,7 @@ pub const IterableDir = struct {
|
||||
.NOTDIR => unreachable,
|
||||
.NOENT => return error.DirNotFound, // The directory being iterated was deleted during iteration.
|
||||
.INVAL => return error.Unexpected, // Linux may in some cases return EINVAL when reading /proc/$PID/net.
|
||||
.ACCES => return error.AccessDenied, // Do not have permission to iterate this directory.
|
||||
else => |err| return os.unexpectedErrno(err),
|
||||
}
|
||||
if (rc == 0) return null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user