aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnoop C S <anoopcs@redhat.com>2017-07-13 15:13:07 +0530
committerAndreas Schneider <asn@samba.org>2018-05-02 14:23:34 +0200
commit501b5f3e6444117dab213f8a3dfdda0a860ecde9 (patch)
tree5bd67380ffadddc92b7ede0121f25202314c41d7 /src
parent64c848748077f31a95b5338d8d6e92050b43e0fc (diff)
downloadsocket_wrapper-501b5f3e6444117dab213f8a3dfdda0a860ecde9.tar.gz
socket_wrapper-501b5f3e6444117dab213f8a3dfdda0a860ecde9.tar.xz
socket_wrapper-501b5f3e6444117dab213f8a3dfdda0a860ecde9.zip
swrap: Rearrange swrap_remove_stale
In preparation to implement thread safety, re-ordering lines of code to properly align to lockign calls Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'src')
-rw-r--r--src/socket_wrapper.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index f1f0036..9c16e1a 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -1928,15 +1928,20 @@ static void swrap_remove_stale(int fd)
return;
}
+ SWRAP_LOG(SWRAP_LOG_TRACE, "remove stale wrapper for %d", fd);
+
si_index = fi->si_index;
- SWRAP_LOG(SWRAP_LOG_TRACE, "remove stale wrapper for %d", fd);
+ si = swrap_get_socket_info(si_index);
+
SWRAP_DLIST_REMOVE(socket_fds, fi);
- free(fi);
- si = swrap_get_socket_info(si_index);
+ swrap_set_next_free(si, first_free);
+ first_free = si_index;
swrap_dec_refcount(si);
+ free(fi);
+
if (swrap_get_refcount(si) > 0) {
return;
}
@@ -1944,9 +1949,6 @@ static void swrap_remove_stale(int fd)
if (si->un_addr.sun_path[0] != '\0') {
unlink(si->un_addr.sun_path);
}
-
- swrap_set_next_free(si, first_free);
- first_free = si_index;
}
static int sockaddr_convert_to_un(struct socket_info *si,