Avoid mutex lock wait in socket close failure
authorAnoop C S <anoopcs@redhat.com>
Fri, 10 Feb 2017 16:08:11 +0000 (21:38 +0530)
committerMichael Adam <obnox@samba.org>
Fri, 10 Feb 2017 17:31:24 +0000 (18:31 +0100)
commit5af15532cefecb5665736f30e00960c17700d1b0
tree16151fcfddba120c47569d39837e4851ee66ed83
parent888a62e2c81370ab32e9bc790f12419148bd8972
Avoid mutex lock wait in socket close failure

In case of absence to close a socket fd during an exit from
application we try to close the same by traversing the
socket_fds in swrap_destructor. But the early lock taken on
libc_symbol_binding_mutex inside the destructor blocks the
subsequent request for locking the same while loading
libc_close within swrap_close.

Also added a test case to verify this flaw in destructor.

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
src/socket_wrapper.c
tests/CMakeLists.txt
tests/test_close_failure.c [new file with mode: 0644]