Skip to content

Commit ec81f44

Browse files
authored
Update net_sockets.c
修复创建socket失败仍然返回有效的fd
1 parent 51db86c commit ec81f44

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

components/dfs/filesystems/net/net_sockets.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,16 @@ int socket(int domain, int type, int protocol)
316316
rt_list_init(&(lwsock->wait_head));
317317
lwsock->conn->callback = event_callback;
318318
}
319+
else
320+
{
321+
/* release fd */
322+
fd_put(d);
323+
fd_put(d);
324+
325+
rt_set_errno(-ENOMEM);
326+
327+
return -1;
328+
}
319329

320330
/* release the ref-count of fd */
321331
fd_put(d);

0 commit comments

Comments
 (0)