From a2d1f21b43c8613848f025b5a9fbe77a5031641e Mon Sep 17 00:00:00 2001 From: aozima Date: Mon, 11 Dec 2017 17:25:25 +0800 Subject: [PATCH] [LWIP] fixed closesocket issues: socket has been closed, delete it from file system fd. --- components/dfs/filesystems/net/net_sockets.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/dfs/filesystems/net/net_sockets.c b/components/dfs/filesystems/net/net_sockets.c index a22fbdc9ad..4f33571129 100644 --- a/components/dfs/filesystems/net/net_sockets.c +++ b/components/dfs/filesystems/net/net_sockets.c @@ -327,6 +327,13 @@ RTM_EXPORT(socket); int closesocket(int s) { int sock = dfs_net_getsocket(s); + struct dfs_fd *d; + + d = fd_get(s); + + /* socket has been closed, delete it from file system fd */ + fd_put(d); + fd_put(d); return lwip_close(sock); }