Skip to content

Commit

Permalink
std.posix: include PermissionDenied to handle errno 13
Browse files Browse the repository at this point in the history
This is to handle the issue described in ziglang#22442.

There is an AccessDenied already there, but posix describes errno 13
specifically as "Permission Denied".
  • Loading branch information
skk64 committed Jan 7, 2025
1 parent 6a21d18 commit 6ceaf1a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/std/posix.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,7 @@ pub const WriteError = error{
NoSpaceLeft,
DeviceBusy,
InvalidArgument,
PermissionDenied,

/// In WASI, this error may occur when the file descriptor does
/// not hold the required rights to write to it.
Expand Down Expand Up @@ -1274,6 +1275,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize {
.CONNRESET => return error.ConnectionResetByPeer,
.BUSY => return error.DeviceBusy,
.NXIO => return error.NoDevice,
.ACCES => return error.PermissionDenied,
else => |err| return unexpectedErrno(err),
}
}
Expand Down

0 comments on commit 6ceaf1a

Please sign in to comment.