authorgravatar for m.stollenga@gmail.comMarijn Stollenga <m.stollenga@gmail.com> 2022-07-01 20:19:13+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-10-13 13:10:29+02:00
log3a9344d8fc757e6c771f689fce0db912e39115e9
tree3b212a28f46ba92d4547c06c0d6e611a9dc0f353
parentcd3d8f3a4ee22a41098b1daf2a36d7fbb342d0fa

Return invalid argument in sendto instead of unreachable, since this can happen with user-side errors


1 files changed, 5 insertions(+), 2 deletions(-)

lib/std/os.zig+5-2
...@@ -5781,7 +5781,10 @@ pub fn sendmsg(...@@ -5781,7 +5781,10 @@ pub fn sendmsg(
5781 }5781 }
5782}5782}
57835783
5784pub const SendToError = SendMsgError;5784pub const SendToError = SendMsgError || error{
5785 /// The destination address is not reachable by the bound address.
5786 UnreachableAddress,
5787};
57855788
5786/// Transmit a message to another socket.5789/// Transmit a message to another socket.
5787///5790///
...@@ -5858,7 +5861,7 @@ pub fn sendto(...@@ -5858,7 +5861,7 @@ pub fn sendto(
5858 .DESTADDRREQ => unreachable, // The socket is not connection-mode, and no peer address is set.5861 .DESTADDRREQ => unreachable, // The socket is not connection-mode, and no peer address is set.
5859 .FAULT => unreachable, // An invalid user space address was specified for an argument.5862 .FAULT => unreachable, // An invalid user space address was specified for an argument.
5860 .INTR => continue,5863 .INTR => continue,
5861 .INVAL => unreachable, // Invalid argument passed.5864 .INVAL => return error.UnreachableAddress,
5862 .ISCONN => unreachable, // connection-mode socket was connected already but a recipient was specified5865 .ISCONN => unreachable, // connection-mode socket was connected already but a recipient was specified
5863 .MSGSIZE => return error.MessageTooBig,5866 .MSGSIZE => return error.MessageTooBig,
5864 .NOBUFS => return error.SystemResources,5867 .NOBUFS => return error.SystemResources,