From 81c777abfdd53cd0302f39df70fb8e17588d6015 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 9 Feb 2013 08:29:37 +0000 Subject: [PATCH] Simplify connect-mode stdin EOF handling. --- ncat/ncat_connect.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ncat/ncat_connect.c b/ncat/ncat_connect.c index 7cf21d6f7..90f4cbe92 100644 --- a/ncat/ncat_connect.c +++ b/ncat/ncat_connect.c @@ -785,12 +785,10 @@ static void read_stdin_handler(nsock_pool nsp, nsock_event evt, void *data) ncat_assert(type == NSE_TYPE_READ); if (status == NSE_STATUS_EOF) { - if (o.sendonly) { - /* In --send-only mode, exit after EOF on stdin. */ + shutdown(nsi_getsd(cs.sock_nsi), SHUT_WR); + /* In --send-only mode, exit after EOF on stdin. */ + if (o.sendonly) nsock_loop_quit(nsp); - } else { - shutdown(nsi_getsd(cs.sock_nsi), SHUT_WR); - } return; } else if (status == NSE_STATUS_ERROR) { loguser("%s.\n", socket_strerror(nse_errorcode(evt)));