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)));