aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-02-24 10:03:40 -0800
committerGitHub <noreply@github.com>2024-02-24 10:03:40 -0800
commit6fddc9cd3d8002a44cf65e05d32c449bde6ca60c (patch)
tree92c2e96c3a8462fb0659a878e789b907a34d9ffa /lib/std/os
parent88b3c144265b0e22250f21809bbf9329ecfcfd6f (diff)
parent9812bc7b10d093f2041471b166e67748665c89c7 (diff)
downloadzig-6fddc9cd3d8002a44cf65e05d32c449bde6ca60c.tar.gz
zig-6fddc9cd3d8002a44cf65e05d32c449bde6ca60c.zip
Merge pull request #19064 from ziglang/fix-netname-deleted
std: map NETNAME_DELETED to error.ConnectionResetByPeer
Diffstat (limited to 'lib/std/os')
-rw-r--r--lib/std/os/windows.zig12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig
index ccbcba6883..1b4b13647b 100644
--- a/lib/std/os/windows.zig
+++ b/lib/std/os/windows.zig
@@ -453,7 +453,8 @@ pub fn FindClose(hFindFile: HANDLE) void {
pub const ReadFileError = error{
BrokenPipe,
- NetNameDeleted,
+ /// The specified network name is no longer available.
+ ConnectionResetByPeer,
OperationAborted,
Unexpected,
};
@@ -485,7 +486,7 @@ pub fn ReadFile(in_hFile: HANDLE, buffer: []u8, offset: ?u64) ReadFileError!usiz
.OPERATION_ABORTED => continue,
.BROKEN_PIPE => return 0,
.HANDLE_EOF => return 0,
- .NETNAME_DELETED => return error.NetNameDeleted,
+ .NETNAME_DELETED => return error.ConnectionResetByPeer,
else => |err| return unexpectedError(err),
}
}
@@ -501,6 +502,8 @@ pub const WriteFileError = error{
/// The process cannot access the file because another process has locked
/// a portion of the file.
LockViolation,
+ /// The specified network name is no longer available.
+ ConnectionResetByPeer,
Unexpected,
};
@@ -517,8 +520,8 @@ pub fn WriteFile(
.InternalHigh = 0,
.DUMMYUNIONNAME = .{
.DUMMYSTRUCTNAME = .{
- .Offset = @as(u32, @truncate(off)),
- .OffsetHigh = @as(u32, @truncate(off >> 32)),
+ .Offset = @truncate(off),
+ .OffsetHigh = @truncate(off >> 32),
},
},
.hEvent = null,
@@ -536,6 +539,7 @@ pub fn WriteFile(
.BROKEN_PIPE => return error.BrokenPipe,
.INVALID_HANDLE => return error.NotOpenForWriting,
.LOCK_VIOLATION => return error.LockViolation,
+ .NETNAME_DELETED => return error.ConnectionResetByPeer,
else => |err| return unexpectedError(err),
}
}