authorgravatar for steve@raffmail.netzigster64 <steve@raffmail.net> 2022-11-22 13:54:33+10:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-01-28 18:27:43-05:00
log2b27bc2c65195a82e96995669314a86c76203a3e
tree0a1a961e83d87c71ca9e9fbfbb206640c73ef5ee
parent5a67ae506a381aa0494b4b066a8c54ba7ed9fc31

On BrokenPipe error during os.sendfile - return error rather than unreachable


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

lib/std/os.zig+4-4
...@@ -6028,7 +6028,7 @@ pub fn sendfile(...@@ -6028,7 +6028,7 @@ pub fn sendfile(
6028 .BADF => unreachable, // Always a race condition.6028 .BADF => unreachable, // Always a race condition.
6029 .FAULT => unreachable, // Segmentation fault.6029 .FAULT => unreachable, // Segmentation fault.
6030 .OVERFLOW => unreachable, // We avoid passing too large of a `count`.6030 .OVERFLOW => unreachable, // We avoid passing too large of a `count`.
6031 .NOTCONN => unreachable, // `out_fd` is an unconnected socket.6031 .NOTCONN => return error.BrokenPipe, // `out_fd` is an unconnected socket
60326032
6033 .INVAL, .NOSYS => {6033 .INVAL, .NOSYS => {
6034 // EINVAL could be any of the following situations:6034 // EINVAL could be any of the following situations:
...@@ -6096,7 +6096,7 @@ pub fn sendfile(...@@ -6096,7 +6096,7 @@ pub fn sendfile(
60966096
6097 .BADF => unreachable, // Always a race condition.6097 .BADF => unreachable, // Always a race condition.
6098 .FAULT => unreachable, // Segmentation fault.6098 .FAULT => unreachable, // Segmentation fault.
6099 .NOTCONN => unreachable, // `out_fd` is an unconnected socket.6099 .NOTCONN => return error.BrokenPipe, // `out_fd` is an unconnected socket
61006100
6101 .INVAL, .OPNOTSUPP, .NOTSOCK, .NOSYS => {6101 .INVAL, .OPNOTSUPP, .NOTSOCK, .NOSYS => {
6102 // EINVAL could be any of the following situations:6102 // EINVAL could be any of the following situations:
...@@ -6178,7 +6178,7 @@ pub fn sendfile(...@@ -6178,7 +6178,7 @@ pub fn sendfile(
6178 .BADF => unreachable, // Always a race condition.6178 .BADF => unreachable, // Always a race condition.
6179 .FAULT => unreachable, // Segmentation fault.6179 .FAULT => unreachable, // Segmentation fault.
6180 .INVAL => unreachable,6180 .INVAL => unreachable,
6181 .NOTCONN => unreachable, // `out_fd` is an unconnected socket.6181 .NOTCONN => return error.BrokenPipe, // `out_fd` is an unconnected socket
61826182
6183 .OPNOTSUPP, .NOTSOCK, .NOSYS => break :sf,6183 .OPNOTSUPP, .NOTSOCK, .NOSYS => break :sf,
61846184
...@@ -6472,7 +6472,7 @@ pub fn recvfrom(...@@ -6472,7 +6472,7 @@ pub fn recvfrom(
6472 .BADF => unreachable, // always a race condition6472 .BADF => unreachable, // always a race condition
6473 .FAULT => unreachable,6473 .FAULT => unreachable,
6474 .INVAL => unreachable,6474 .INVAL => unreachable,
6475 .NOTCONN => unreachable,6475 .NOTCONN => return error.SocketNotConnected,
6476 .NOTSOCK => unreachable,6476 .NOTSOCK => unreachable,
6477 .INTR => continue,6477 .INTR => continue,
6478 .AGAIN => return error.WouldBlock,6478 .AGAIN => return error.WouldBlock,