diff --git a/ncat/ncat_connect.c b/ncat/ncat_connect.c index a543072b2..89d4ebdca 100644 --- a/ncat/ncat_connect.c +++ b/ncat/ncat_connect.c @@ -1084,8 +1084,10 @@ int ncat_connect(void) else { /* Create IOD for nsp->stdin */ + if (!o.recvonly) { if ((cs.stdin_nsi = nsock_iod_new2(mypool, 0, NULL)) == NULL) - bye("Failed to create stdin nsiod."); + bye("Failed to create stdin nsiod."); + } post_connect(mypool, cs.sock_nsi); } @@ -1230,8 +1232,10 @@ static void connect_handler(nsock_pool nsp, nsock_event evt, void *data) } /* Create IOD for nsp->stdin */ - if ((cs.stdin_nsi = nsock_iod_new2(nsp, 0, NULL)) == NULL) + if (!o.recvonly) { + if ((cs.stdin_nsi = nsock_iod_new2(nsp, 0, NULL)) == NULL) bye("Failed to create stdin nsiod."); + } post_connect(nsp, nse_iod(evt)); } diff --git a/ncat/ncat_listen.c b/ncat/ncat_listen.c index 898f9a6db..f05cbfb79 100644 --- a/ncat/ncat_listen.c +++ b/ncat/ncat_listen.c @@ -295,7 +295,8 @@ int ncat_listen() bye("Unable to open any listening sockets."); } - add_fd(&client_fdlist, STDIN_FILENO); + if (!o.recvonly) + add_fd(&client_fdlist, STDIN_FILENO); init_fdlist(&broadcast_fdlist, o.conn_limit); @@ -602,7 +603,7 @@ static void post_handle_connection(struct fdinfo *sinfo) netexec(sinfo, o.cmdexec); } else { /* Now that a client is connected, pay attention to stdin. */ - if (!stdin_eof) + if (!stdin_eof && !o.recvonly) checked_fd_set(STDIN_FILENO, &master_readfds); if (!o.sendonly) { /* add to our lists */