mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-11 07:25:19 +00:00
When telnetd_daemon() starts without open standard streams - exactly what happens when nsh_telnetstart() spawns "telnetd &" before the console device exists (e.g. CONFIG_NSH_USBCONSOLE boards, where nsh_initialize() runs before the USB console is connected) - socket() returns a descriptor in the 0..2 range. The accept loop's own "go silent" close(0)..close(2) then destroys the listen socket on the first iteration: every subsequent accept4() fails with EBADF and the daemon serves nothing. Observed on hardware (RP2350, CDC-ACM console + CDC-NCM composite): the daemon task was alive but port 23 refused every connection; the thread list showed it looping on the failed accept. Duplicate the descriptor above the standard-stream range before using it. Assisted-by: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Ricard Rosson <ricard@groundbits.com> |
||
|---|---|---|
| .. | ||
| CMakeLists.txt | ||
| Kconfig | ||
| Make.defs | ||
| Makefile | ||
| telnetd_daemon.c | ||