Prototypes for send and recv. Fixed send (pass null address) and sendto
(fail when a null address is passed to a socket that is not connected).
This commit is contained in:
+1
-4
@@ -3,9 +3,6 @@
|
||||
|
||||
ssize_t send(int socket, const void *buffer, size_t length, int flags)
|
||||
{
|
||||
struct sockaddr sa;
|
||||
|
||||
sa.sa_family= AF_UNSPEC;
|
||||
return sendto(socket, buffer, length, flags, &sa, sizeof(sa));
|
||||
return sendto(socket, buffer, length, flags, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,12 @@ static ssize_t _udp_sendto(int socket, const void *message, size_t length,
|
||||
if ((udpoptp->nwuo_flags & NWUO_RP_ANY) ||
|
||||
(udpoptp->nwuo_flags & NWUO_RA_ANY))
|
||||
{
|
||||
if (!dest_addr)
|
||||
{
|
||||
errno= ENOTCONN;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Check destination address */
|
||||
if (dest_len < sizeof(*sinp))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user