From 74bbf2dccab04c845ae6b1b957f550a4b6693885 Mon Sep 17 00:00:00 2001 From: dmiller Date: Sun, 1 Oct 2017 03:28:09 +0000 Subject: [PATCH] Don't use socket close on STDOUT, use IO close instead. See #978 --- ncat/ncat_connect.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ncat/ncat_connect.c b/ncat/ncat_connect.c index b3b0efd9c..77bf2ae72 100644 --- a/ncat/ncat_connect.c +++ b/ncat/ncat_connect.c @@ -1304,7 +1304,11 @@ static void read_socket_handler(nsock_pool nsp, nsock_event evt, void *data) ncat_assert(type == NSE_TYPE_READ); if (status == NSE_STATUS_EOF) { +#ifdef WIN32 + _close(STDOUT_FILENO); +#else Close(STDOUT_FILENO); +#endif /* In --recv-only mode or non-TCP mode, exit after EOF on the socket. */ if (o.proto != IPPROTO_TCP || (o.proto == IPPROTO_TCP && o.recvonly)) nsock_loop_quit(nsp);