zig

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

commit c172877b81f4eff50cf214eb553c9df108fbd9eb (tree)
parent 414fc3b207b2447f2ea131b57495b3480a3b4a94
Author: saurabh <tech@saurabh.mozmail.com>
Date:   Wed, 11 Dec 2024 04:36:51 +0530

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

Co-authored-by: Saurabh <saurabhm@proton.me>
Diffstat:
Mlib/std/posix.zig | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/std/posix.zig b/lib/std/posix.zig @@ -1191,6 +1191,9 @@ pub const WriteError = error{ /// This error occurs in Linux if the process being written to /// no longer exists. ProcessNotFound, + /// 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, } || UnexpectedError; /// Write to a file descriptor. @@ -1270,6 +1273,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize { .PIPE => return error.BrokenPipe, .CONNRESET => return error.ConnectionResetByPeer, .BUSY => return error.DeviceBusy, + .NXIO => return error.NoDevice, else => |err| return unexpectedErrno(err), } }