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:
Philip Homburg
2006-07-14 14:34:00 +00:00
parent 371ac29c9f
commit 59830eda3f
3 changed files with 11 additions and 4 deletions
+1 -4
View File
@@ -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);
}
+6
View File
@@ -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))
{