diff options
| -rw-r--r-- | src/socket_wrapper.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index 8ac838b..1961549 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -5363,20 +5363,20 @@ static int swrap_close(int fd) SWRAP_DLIST_REMOVE(socket_fds, fi); free(fi); + ret = libc_close(fd); + si = &sockets[si_index]; si->refcount--; if (si->refcount > 0) { /* there are still references left */ - return libc_close(fd); + return ret; } if (si->myname.sa_socklen > 0 && si->peername.sa_socklen > 0) { swrap_pcap_dump_packet(si, NULL, SWRAP_CLOSE_SEND, NULL, 0); } - ret = libc_close(fd); - if (si->myname.sa_socklen > 0 && si->peername.sa_socklen > 0) { swrap_pcap_dump_packet(si, NULL, SWRAP_CLOSE_RECV, NULL, 0); swrap_pcap_dump_packet(si, NULL, SWRAP_CLOSE_ACK, NULL, 0); |
