dropbear
dropbear copied to clipboard
Don't close channels when a PID hasn't started
If check_close() ran prior to a server channel exec/shell request, it would send a close immediately. This fix changes it to exclude write_fd==FD_UNINIT from being closed there.
When a channel was closed by the time shell/exec request was received, then data sent hits an assertion. This fixes #321 on Github.
The "pid == 0" check was initially added to avoid waiting to close a channel when a process has never been launched (which is correct), but that isn't correct in the case of the closed-fd test.
Fixes: 8e6f73e879ca ("- Remove "flushing" handling for exited processes)