You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/01/17 17:26:56 UTC
[incubator-nuttx] branch master updated: net/inet/inet_recvfrom.c:
Correct the return value (#121)
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 3e230ca net/inet/inet_recvfrom.c: Correct the return value (#121)
3e230ca is described below
commit 3e230ca9eb597fb6ad70acd2dd527037b43a68e0
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Fri Jan 17 09:26:47 2020 -0800
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().
---
net/inet/inet_recvfrom.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/inet/inet_recvfrom.c b/net/inet/inet_recvfrom.c
index b217cca..7d56b54 100644
--- a/net/inet/inet_recvfrom.c
+++ b/net/inet/inet_recvfrom.c
@@ -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 */