diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2013-12-05 12:07:27 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2013-12-05 13:43:45 +0100 |
commit | 0beaff21197b4bc23100eac025c08f0e957243e8 (patch) | |
tree | 00609b66438190c1d415732c716352c0937510c8 /src/socket_wrapper.c | |
parent | 19ada82dbdab1d01fe8b449ab5b2448ffeac51b5 (diff) | |
download | socket_wrapper-0beaff21197b4bc23100eac025c08f0e957243e8.tar.gz socket_wrapper-0beaff21197b4bc23100eac025c08f0e957243e8.tar.xz socket_wrapper-0beaff21197b4bc23100eac025c08f0e957243e8.zip |
swrap: Use swrap structure for close.
Diffstat (limited to 'src/socket_wrapper.c')
-rw-r--r-- | src/socket_wrapper.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index a4c2053..15fb37f 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -541,17 +541,6 @@ static void *libc_dlsym(const char *name) return func; } -static int (*libc_close)(int fd); - -static int real_close(int fd) -{ - if (libc_close == NULL) { - *(void **)(&libc_close) = libc_dlsym("close"); - } - - return libc_close(fd); -} - static int (*libc_connect)(int sockfd, const struct sockaddr *addr, socklen_t addrlen); @@ -3388,7 +3377,7 @@ static int swrap_close(int fd) int ret; if (!si) { - return real_close(fd); + return swrap.fns.libc_close(fd); } for (fi = si->fds; fi; fi = fi->next) { @@ -3401,7 +3390,7 @@ static int swrap_close(int fd) if (si->fds) { /* there are still references left */ - return real_close(fd); + return swrap.fns.libc_close(fd); } SWRAP_DLIST_REMOVE(sockets, si); @@ -3410,7 +3399,7 @@ static int swrap_close(int fd) swrap_dump_packet(si, NULL, SWRAP_CLOSE_SEND, NULL, 0); } - ret = real_close(fd); + ret = swrap.fns.libc_close(fd); if (si->myname && si->peername) { swrap_dump_packet(si, NULL, SWRAP_CLOSE_RECV, NULL, 0); |