Ignore stdin with --recv-only
Some checks are pending
nmap multiplatform autobuilds / build (arm64, gcc, ubuntu-latest-gcc-arm64, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (clang, freebsd-15-clang, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (clang, macos-15-clang, macos-15) (push) Waiting to run
nmap multiplatform autobuilds / build (clang, macos-26-clang, macos-26) (push) Waiting to run
nmap multiplatform autobuilds / build (clang, netbsd-10-clang, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (clang, openbsd-7-clang, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (clang, solaris-11-clang, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (clang, ubuntu-latest-clang, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (egcc, openbsd-7-gcc, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (gcc, freebsd-15-gcc, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (gcc, netbsd-10-gcc, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (gcc, solaris-11-gcc, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (gcc, ubuntu-latest-gcc, ubuntu-latest) (push) Waiting to run
nmap multiplatform autobuilds / build (msvc, windows-latest-msvc, windows-latest) (push) Waiting to run

This commit is contained in:
dmiller 2026-05-15 17:34:41 +00:00
parent e9861daf84
commit b408fc243c
2 changed files with 9 additions and 4 deletions

View file

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

View file

@ -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 */