Don't sometimes hang just after launching ssh

sshd has a bug in which the sometimes it may get stuck trying to read from the client
even though the child process has already exited. This is visible at
https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/serverloop.c?annotate=1.226 line 274:
once the child is waited on, `child_terminated` is reset to 0, which causes it to use an infinite timeout 
in the select there.

This workaround causes mosh to disconnect from the server, thereby allowing sshd finish.
This commit is contained in:
Kalle Samuels
2021-10-28 12:38:04 -07:00
committed by GitHub
parent e023e81c08
commit 9cf1a9c8ee
+1 -1
View File
@@ -439,8 +439,8 @@ if ( $pid == 0 ) { # child
print "$_\n"; print "$_\n";
} }
} }
waitpid $pid, 0;
close $pipe; close $pipe;
waitpid $pid, 0;
if ( not defined $ip ) { if ( not defined $ip ) {
if ( defined $sship ) { if ( defined $sship ) {