sendto should always call send if to == NULL || tolen <= 0

Since UDP socket may bind the target with connect call
This commit is contained in:
Xiang Xiao 2020-01-31 18:00:39 +08:00 committed by Gregory Nutt
parent 7e67add999
commit 0fc7668d65

View File

@ -139,13 +139,7 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf,
if (to == NULL || tolen <= 0)
{
#if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL_STREAM) || \
defined(CONFIG_NET_USRSOCK)
return psock_send(psock, buf, len, flags);
#else
nerr("ERROR: No 'to' address\n");
return -EINVAL;
#endif
}
/* Verify that the psock corresponds to valid, allocated socket */