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.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 0d74321..353a9a5 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -3934,6 +3934,9 @@ static int swrap_dup(int fd)
return -1;
}
+ /* Make sure we don't have an entry for the fd */
+ swrap_remove_stale(fi->fd);
+
SWRAP_DLIST_ADD(si->fds, fi);
return fi->fd;
}
@@ -3978,6 +3981,9 @@ static int swrap_dup2(int fd, int newfd)
return -1;
}
+ /* Make sure we don't have an entry for the fd */
+ swrap_remove_stale(fi->fd);
+
SWRAP_DLIST_ADD(si->fds, fi);
return fi->fd;
}