mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 09:18:00 +08:00
net/inet: move socket error into socket_conn_s
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
99cde13a11
commit
1659513edb
@@ -242,8 +242,8 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
*(FAR int *)value = (int)psock->s_error;
|
||||
psock->s_error = 0;
|
||||
*(FAR int *)value = (int)conn->s_error;
|
||||
conn->s_error = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -113,7 +113,6 @@ ssize_t psock_sendfile(FAR struct socket *psock, FAR struct file *infile,
|
||||
if (psock == NULL || psock->s_conn == NULL)
|
||||
{
|
||||
nerr("ERROR: Invalid socket\n");
|
||||
psock->s_error = EBADF;
|
||||
return -EBADF;
|
||||
}
|
||||
|
||||
@@ -134,7 +133,8 @@ ssize_t psock_sendfile(FAR struct socket *psock, FAR struct file *infile,
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
psock->s_error = -ret;
|
||||
FAR struct socket_conn_s *conn = psock->s_conn;
|
||||
conn->s_error = -ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
+3
-2
@@ -95,9 +95,10 @@
|
||||
# define _SO_SETERRNO(s,e) \
|
||||
do \
|
||||
{ \
|
||||
if (s != NULL) \
|
||||
if (s != NULL && (s)->s_conn != NULL) \
|
||||
{ \
|
||||
s->s_error = (int16_t)e; \
|
||||
FAR struct socket_conn_s *_conn = (s)->s_conn; \
|
||||
_conn->s_error = (int16_t)e; \
|
||||
} \
|
||||
set_errno(e); \
|
||||
} \
|
||||
|
||||
Reference in New Issue
Block a user