net/inet/inet_recvfrom.c: Correct the return value (#121)
NuttX follows OpenGroup.org: https://pubs.opengroup.org/onlinepubs/009695399/functions/recv.html : [EAGAIN] or [EWOULDBLOCK] The socket's file descriptor is marked O_NONBLOCK and no data is waiting to be received; or MSG_OOB is set and no out-of-band data is available and either the socket's file descriptor is marked O_NONBLOCK or the socket does not support blocking to await out-of-band data. ETIMEDOUT is not a valid error to be returned from recv() or recvfrom().
This commit is contained in:
parent
41efa2ae72
commit
3e230ca9eb
@ -1086,6 +1086,10 @@ static ssize_t inet_udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t
|
||||
*/
|
||||
|
||||
ret = net_timedwait(&state. ir_sem, _SO_TIMEOUT(psock->s_rcvtimeo));
|
||||
if (ret == -ETIMEDOUT)
|
||||
{
|
||||
ret = -EAGAIN;
|
||||
}
|
||||
|
||||
/* Make sure that no further events are processed */
|
||||
|
||||
@ -1236,6 +1240,10 @@ static ssize_t inet_tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t
|
||||
*/
|
||||
|
||||
ret = net_timedwait(&state.ir_sem, _SO_TIMEOUT(psock->s_rcvtimeo));
|
||||
if (ret == -ETIMEDOUT)
|
||||
{
|
||||
ret = -EAGAIN;
|
||||
}
|
||||
|
||||
/* Make sure that no further events are processed */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user