Skip to content

Commit 0f991c2

Browse files
committed
[sal] fix
1 parent 3f122bd commit 0f991c2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

components/net/sal_socket/src/sal_socket.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,13 @@ struct sal_socket *sal_get_socket(int socket)
309309
{
310310
struct sal_socket_table *st = &socket_table;
311311

312+
socket = socket - SAL_SOCKET_OFFSET;
313+
312314
if (socket < 0 || socket >= (int) st->max_socket)
313315
{
314316
return RT_NULL;
315317
}
316318

317-
socket = socket - SAL_SOCKET_OFFSET;
318319
/* check socket structure valid or not */
319320
RT_ASSERT(st->sockets[socket]->magic == SAL_SOCKET_MAGIC);
320321

@@ -975,7 +976,7 @@ int sal_closesocket(int socket)
975976

976977
/* clsoesocket operation not need to vaild network interface status */
977978
/* valid the network interface socket opreation */
978-
SAL_NETDEV_SOCKETOPS_VALID(sock->netdev, pf, socket);
979+
SAL_NETDEV_SOCKETOPS_VALID(sock->netdev, pf, closesocket);
979980

980981
if (pf->skt_ops->closesocket((int) sock->user_data) == 0)
981982
{

0 commit comments

Comments
 (0)