mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-19 17:13:31 +08:00
Update net_sockets.c
修复创建socket失败仍然返回有效的fd
This commit is contained in:
parent
51db86ca52
commit
ec81f44ff9
@ -316,6 +316,16 @@ int socket(int domain, int type, int protocol)
|
||||
rt_list_init(&(lwsock->wait_head));
|
||||
lwsock->conn->callback = event_callback;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* release fd */
|
||||
fd_put(d);
|
||||
fd_put(d);
|
||||
|
||||
rt_set_errno(-ENOMEM);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* release the ref-count of fd */
|
||||
fd_put(d);
|
||||
|
Loading…
x
Reference in New Issue
Block a user