summaryrefslogtreecommitdiffstats
path: root/src/socket_wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket_wrapper.c')
-rw-r--r--src/socket_wrapper.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 955b6ad..d7525f8 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -2023,7 +2023,15 @@ static int swrap_socket(int family, int type, int protocol)
*/
fd = libc_socket(AF_UNIX, type, 0);
- if (fd == -1) return -1;
+ if (fd == -1) {
+ return -1;
+ }
+
+ /* Check if we have a stale fd and remove it */
+ si = find_socket_info(fd);
+ if (si != NULL) {
+ swrap_remove_stale(fd);
+ }
si = (struct socket_info *)malloc(sizeof(struct socket_info));
memset(si, 0, sizeof(struct socket_info));