swrap: call libc_write() directly for internal fds
Otherwise we may deadlock with a backtrace like this:
swrap_accept():
...
SWRAP_LOCK_SI(si);
swrap_pcap_dump_packet() ->
write() ->
swrap_write() ->
SWRAP_LOCK_SI(si) -> abort()
This can happen if libc_open() called from swrap_pcap_get_fd()
return a stale fd. This may happen if glibc calls socket()
and closes it with __close_nocancel() instead of close().
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14640
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>