socket: separation error code EBADF and ENOTSOCK

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu
2022-10-27 18:17:35 +08:00
committed by Petro Karashchenko
parent 2c95c04f4e
commit f00c11aec4
16 changed files with 115 additions and 79 deletions
+7 -3
View File
@@ -147,11 +147,15 @@ ssize_t sendmsg(int sockfd, FAR struct msghdr *msg, int flags)
/* Get the underlying socket structure */
psock = sockfd_socket(sockfd);
ret = sockfd_socket(sockfd, &psock);
/* Then let psock_sendmsg() do all of the work */
/* Let psock_sendmsg() do all of the work */
if (ret == OK)
{
ret = psock_sendmsg(psock, msg, flags);
}
ret = psock_sendmsg(psock, msg, flags);
if (ret < 0)
{
_SO_SETERRNO(psock, -ret);