zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 42160327dc55fd4a00634cc3fd461a5844aa8e73 (tree)
parent 11b49e90024da21e806a71a7ee62b23572836cee
Author: Rémy Mathieu <remeh@remeh.fr>
Date:   Sat, 15 Mar 2025 12:04:42 +0100

posix/write: catch MSGSIZE error (#23238)


Diffstat:
Mlib/std/posix.zig | 5+++++
Msrc/fmt.zig | 1+
2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/std/posix.zig b/lib/std/posix.zig @@ -1198,6 +1198,10 @@ pub const WriteError = error{ /// This error occurs when a device gets disconnected before or mid-flush /// while it's being written to - errno(6): No such device or address. NoDevice, + + /// The socket type requires that message be sent atomically, and the size of the message + /// to be sent made this impossible. The message is not transmitted. + MessageTooBig, } || UnexpectedError; /// Write to a file descriptor. @@ -1279,6 +1283,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize { .CONNRESET => return error.ConnectionResetByPeer, .BUSY => return error.DeviceBusy, .NXIO => return error.NoDevice, + .MSGSIZE => return error.MessageTooBig, else => |err| return unexpectedErrno(err), } } diff --git a/src/fmt.zig b/src/fmt.zig @@ -202,6 +202,7 @@ const FmtError = error{ DestinationAddressRequired, DiskQuota, FileTooBig, + MessageTooBig, InputOutput, NoSpaceLeft, AccessDenied,