authorgravatar for remeh@remeh.frRémy Mathieu <remeh@remeh.fr> 2025-03-15 12:04:42+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-03-15 12:04:42+01:00
log42160327dc55fd4a00634cc3fd461a5844aa8e73
tree0a35a8e78c27e80a5da7fe912e4978b8d8998310
parent11b49e90024da21e806a71a7ee62b23572836cee
signaturebadge-check Signed by PGP key B5690EEEBB952194

posix/write: catch MSGSIZE error (#23238)


2 files changed, 6 insertions(+), 0 deletions(-)

lib/std/posix.zig+5
......@@ -1198,6 +1198,10 @@ pub const WriteError = error{
11981198 /// This error occurs when a device gets disconnected before or mid-flush
11991199 /// while it's being written to - errno(6): No such device or address.
12001200 NoDevice,
1201
1202 /// The socket type requires that message be sent atomically, and the size of the message
1203 /// to be sent made this impossible. The message is not transmitted.
1204 MessageTooBig,
12011205} || UnexpectedError;
12021206
12031207/// Write to a file descriptor.
......@@ -1279,6 +1283,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize {
12791283 .CONNRESET => return error.ConnectionResetByPeer,
12801284 .BUSY => return error.DeviceBusy,
12811285 .NXIO => return error.NoDevice,
1286 .MSGSIZE => return error.MessageTooBig,
12821287 else => |err| return unexpectedErrno(err),
12831288 }
12841289 }
src/fmt.zig+1
......@@ -202,6 +202,7 @@ const FmtError = error{
202202 DestinationAddressRequired,
203203 DiskQuota,
204204 FileTooBig,
205 MessageTooBig,
205206 InputOutput,
206207 NoSpaceLeft,
207208 AccessDenied,