Skip to content

Commit 4216032

Browse files
authored
posix/write: catch MSGSIZE error (#23238)
1 parent 11b49e9 commit 4216032

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/std/posix.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ const FmtError = error{
202202
DestinationAddressRequired,
203203
DiskQuota,
204204
FileTooBig,
205+
MessageTooBig,
205206
InputOutput,
206207
NoSpaceLeft,
207208
AccessDenied,

0 commit comments

Comments
 (0)