mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
Return invalid argument in sendto instead of unreachable, since this can happen with user-side errors
This commit is contained in:
parent
cd3d8f3a4e
commit
3a9344d8fc
@ -5781,7 +5781,10 @@ pub fn sendmsg(
|
||||
}
|
||||
}
|
||||
|
||||
pub const SendToError = SendMsgError;
|
||||
pub const SendToError = SendMsgError || error{
|
||||
/// The destination address is not reachable by the bound address.
|
||||
UnreachableAddress,
|
||||
};
|
||||
|
||||
/// Transmit a message to another socket.
|
||||
///
|
||||
@ -5858,7 +5861,7 @@ pub fn sendto(
|
||||
.DESTADDRREQ => unreachable, // The socket is not connection-mode, and no peer address is set.
|
||||
.FAULT => unreachable, // An invalid user space address was specified for an argument.
|
||||
.INTR => continue,
|
||||
.INVAL => unreachable, // Invalid argument passed.
|
||||
.INVAL => return error.UnreachableAddress,
|
||||
.ISCONN => unreachable, // connection-mode socket was connected already but a recipient was specified
|
||||
.MSGSIZE => return error.MessageTooBig,
|
||||
.NOBUFS => return error.SystemResources,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user