Skip to content

Commit

Permalink
sendto should always call send if to == NULL || tolen <= 0
Browse files Browse the repository at this point in the history
Since UDP socket may bind the target with connect call
  • Loading branch information
xiaoxiang781216 authored and gregory-nutt committed Jan 31, 2020
1 parent 7e67add commit 0fc7668
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions net/socket/sendto.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 0fc7668

Please sign in to comment.