Skip to content
Snippets Groups Projects
Commit 2035b336 authored by patacongo's avatar patacongo
Browse files

Fix errors in return value from non-blocking read

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2018 42af7a65-404d-4744-a932-0658087f49c3
parent 69544599
No related branches found
No related tags found
No related merge requests found
......@@ -704,7 +704,7 @@ static void recvfrom_init(FAR struct socket *psock, FAR void *buf, size_t len,
#if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_TCP)
static ssize_t recvfrom_result(int result, struct recvfrom_s *pstate)
{
int save_errno = *get_errno_ptr(); /* In case something we do changes it */
int save_errno = errno; /* In case something we do changes it */
/* Release semaphore in the state structure */
......@@ -896,7 +896,13 @@ static ssize_t tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
{
/* Nothing was received */
return -EAGAIN;
ret = -EAGAIN;
}
else
{
/* The return value is the number of bytes read from the read-ahead buffer */
ret = state.rf_recvlen;
}
}
......@@ -1091,7 +1097,7 @@ ssize_t recvfrom(int sockfd, FAR void *buf, size_t len, int flags,
return ret;
errout:
*get_errno_ptr() = err;
errno = err;
return ERROR;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment