authorgravatar for saurabhm@proton.mesaurabh <saurabhm@proton.me> 2024-12-11 04:36:51+05:30
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-12-11 00:06:51+01:00
logc172877b81f4eff50cf214eb553c9df108fbd9eb
tree128ee947768c59c7dc4b1e509851d8d69fb8379d
parent414fc3b207b2447f2ea131b57495b3480a3b4a94
signaturebadge-check Signed by PGP key B5690EEEBB952194

std.posix: map errno 6 (ENXIO) to error.NoDevice in write() (#22113)

Co-authored-by: Saurabh <saurabhm@proton.me>

1 files changed, 4 insertions(+), 0 deletions(-)

lib/std/posix.zig+4
......@@ -1191,6 +1191,9 @@ pub const WriteError = error{
11911191 /// This error occurs in Linux if the process being written to
11921192 /// no longer exists.
11931193 ProcessNotFound,
1194 /// This error occurs when a device gets disconnected before or mid-flush
1195 /// while it's being written to - errno(6): No such device or address.
1196 NoDevice,
11941197} || UnexpectedError;
11951198
11961199/// Write to a file descriptor.
......@@ -1270,6 +1273,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize {
12701273 .PIPE => return error.BrokenPipe,
12711274 .CONNRESET => return error.ConnectionResetByPeer,
12721275 .BUSY => return error.DeviceBusy,
1276 .NXIO => return error.NoDevice,
12731277 else => |err| return unexpectedErrno(err),
12741278 }
12751279 }