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(
57815781 }
57825782}
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
57865789/// Transmit a message to another socket.
57875790///
......@@ -5858,7 +5861,7 @@ pub fn sendto(
58585861 .DESTADDRREQ => unreachable, // The socket is not connection-mode, and no peer address is set.
58595862 .FAULT => unreachable, // An invalid user space address was specified for an argument.
58605863 .INTR => continue,
5861 .INVAL => unreachable, // Invalid argument passed.
5864 .INVAL => return error.UnreachableAddress,
58625865 .ISCONN => unreachable, // connection-mode socket was connected already but a recipient was specified
58635866 .MSGSIZE => return error.MessageTooBig,
58645867 .NOBUFS => return error.SystemResources,