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
commit 608436a75f167d09d3c9cca4dd9b80f1e284a6f7 Author: chao.an <[email protected]> AuthorDate: Wed May 13 12:08:32 2020 +0800 net/sockopt: do not set the errno to SO_ERROR SO_ERROR is used to report asynchronous errors that are the result of events within the network stack and not synchronous errors that are the result of a library call(send/recv/connect) Synchronous results are reported via errno. Linux Programmer's Manual ... NAME getsockopt, setsockopt - get and set options on sockets ... RETURN VALUE ... On error, -1 is returned, and errno is set appropriately Change-Id: I1a1a05a684dff8672aaf47eabee157ac0d275c2d Signed-off-by: chao.an <[email protected]> --- net/socket/getsockopt.c | 2 +- net/socket/setsockopt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/socket/getsockopt.c b/net/socket/getsockopt.c index 2bc1c73..45cf495 100644 --- a/net/socket/getsockopt.c +++ b/net/socket/getsockopt.c @@ -445,7 +445,7 @@ int getsockopt(int sockfd, int level, int option, void *value, socklen_t *value_ ret = psock_getsockopt(psock, level, option, value, value_len); if (ret < 0) { - _SO_SETERRNO(psock, -ret); + set_errno(-ret); return ERROR; } diff --git a/net/socket/setsockopt.c b/net/socket/setsockopt.c index e968467..468d06c 100644 --- a/net/socket/setsockopt.c +++ b/net/socket/setsockopt.c @@ -470,7 +470,7 @@ int setsockopt(int sockfd, int level, int option, const void *value, ret = psock_setsockopt(psock, level, option, value, value_len); if (ret < 0) { - _SO_SETERRNO(psock, -ret); + set_errno(-ret); return ERROR; }
