diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-10-27 18:56:04 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-10-27 18:56:04 +0000 |
commit | 1e60556b89305022b6cefe9bb28badb51dc15620 (patch) | |
tree | d07c947b44430bff1520bd7ced5fe49e19b26bf3 /nuttx/net | |
parent | a7e644a852025eeb8af8648f73aac7c9ffc315bd (diff) | |
download | px4-nuttx-1e60556b89305022b6cefe9bb28badb51dc15620.tar.gz px4-nuttx-1e60556b89305022b6cefe9bb28badb51dc15620.tar.bz2 px4-nuttx-1e60556b89305022b6cefe9bb28badb51dc15620.zip |
Fixes found in smtp testing
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@356 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net')
-rw-r--r-- | nuttx/net/connect.c | 3 | ||||
-rw-r--r-- | nuttx/net/recvfrom.c | 25 |
2 files changed, 15 insertions, 13 deletions
diff --git a/nuttx/net/connect.c b/nuttx/net/connect.c index 523c1d7c1..786a0e4e7 100644 --- a/nuttx/net/connect.c +++ b/nuttx/net/connect.c @@ -258,8 +258,7 @@ int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) goto errout; } - err = ENOSYS; - /*return OK;*/ + return OK; errout: *get_errno_ptr() = err; diff --git a/nuttx/net/recvfrom.c b/nuttx/net/recvfrom.c index 0665b54f1..8548924ec 100644 --- a/nuttx/net/recvfrom.c +++ b/nuttx/net/recvfrom.c @@ -406,7 +406,7 @@ static ssize_t recvfrom_result(int result, struct recvfrom_s *pstate) * psock Pointer to the socket structure for the SOCK_DRAM socket * buf Buffer to receive data * len Length of buffer - * infrom INET ddress of source + * infrom INET ddress of source (may be NULL) * * Returned Value: * On success, returns the number of characters sent. On error, @@ -489,7 +489,7 @@ static ssize_t udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, * psock Pointer to the socket structure for the SOCK_DRAM socket * buf Buffer to receive data * len Length of buffer - * infrom INET ddress of source + * infrom INET ddress of source (may be NULL) * * Returned Value: * On success, returns the number of characters sent. On error, @@ -575,7 +575,7 @@ static ssize_t tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len, * buf Buffer to receive data * len Length of buffer * flags Receive flags - * from Address of source + * from Address of source (may be NULL) * fromlen The length of the address structure * * Returned Value: @@ -624,7 +624,7 @@ ssize_t recvfrom(int sockfd, FAR void *buf, size_t len, int flags, FAR struct so /* Verify that non-NULL pointers were passed */ - if (!buf || !from || !fromlen) + if (!buf) { err = EINVAL; goto errout; @@ -640,17 +640,20 @@ ssize_t recvfrom(int sockfd, FAR void *buf, size_t len, int flags, FAR struct so goto errout; } - /* Verify that a valid address has been provided */ + /* If a 'from' address has been provided, verify that it is valid */ + if (from) + { #ifdef CONFIG_NET_IPv6 - if (from->sa_family != AF_INET6 || *fromlen < sizeof(struct sockaddr_in6)) + if (from->sa_family != AF_INET6 || *fromlen < sizeof(struct sockaddr_in6)) #else - if (from->sa_family != AF_INET || *fromlen < sizeof(struct sockaddr_in)) + if (from->sa_family != AF_INET || *fromlen < sizeof(struct sockaddr_in)) #endif - { - err = EBADF; - goto errout; - } + { + err = EBADF; + goto errout; + } + } /* Set the socket state to receiving */ |