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{...@@ -1191,6 +1191,9 @@ pub const WriteError = error{
1191 /// This error occurs in Linux if the process being written to1191 /// This error occurs in Linux if the process being written to
1192 /// no longer exists.1192 /// no longer exists.
1193 ProcessNotFound,1193 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,
1194} || UnexpectedError;1197} || UnexpectedError;
11951198
1196/// Write to a file descriptor.1199/// Write to a file descriptor.
...@@ -1270,6 +1273,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize {...@@ -1270,6 +1273,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize {
1270 .PIPE => return error.BrokenPipe,1273 .PIPE => return error.BrokenPipe,
1271 .CONNRESET => return error.ConnectionResetByPeer,1274 .CONNRESET => return error.ConnectionResetByPeer,
1272 .BUSY => return error.DeviceBusy,1275 .BUSY => return error.DeviceBusy,
1276 .NXIO => return error.NoDevice,
1273 else => |err| return unexpectedErrno(err),1277 else => |err| return unexpectedErrno(err),
1274 }1278 }
1275 }1279 }