aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2016-10-25 13:42:05 +0200
committerMichael Adam <obnox@samba.org>2016-10-25 14:55:13 +0200
commitddba8cf2058d662d628fc62f5896b873754ba7c3 (patch)
tree0e4ba31327d1a3b859171f3c6eb791c9c5aa933c /src
parent3b39c88b138f88bffc7d71572a9c6a83e54a03c9 (diff)
downloadsocket_wrapper-ddba8cf2058d662d628fc62f5896b873754ba7c3.tar.gz
socket_wrapper-ddba8cf2058d662d628fc62f5896b873754ba7c3.tar.xz
socket_wrapper-ddba8cf2058d662d628fc62f5896b873754ba7c3.zip
swrap: slightly cleanup logic in swrap_close
This moves the libc_close() to one central point, thereby grouping the fd-related operations together and the the socket-info related operations after that. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'src')
-rw-r--r--src/socket_wrapper.c6
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);