mosh: "Fix hang when remote closes the connection"
Merge
b58e750daf
into the C++ wrapper script.
This commit is contained in:
parent
1f87518b8c
commit
3afa4f345a
@ -317,13 +317,16 @@ int main( int argc, char *argv[] )
|
|||||||
int pid = fork();
|
int pid = fork();
|
||||||
if ( pid == -1 ) die( "%s: fork: %d", argv[0], errno );
|
if ( pid == -1 ) die( "%s: fork: %d", argv[0], errno );
|
||||||
if ( pid == 0 ) {
|
if ( pid == 0 ) {
|
||||||
cat( sockfd, 1 );
|
close( STDIN_FILENO );
|
||||||
|
cat( sockfd, STDOUT_FILENO );
|
||||||
shutdown( sockfd, 0 );
|
shutdown( sockfd, 0 );
|
||||||
exit( 0 );
|
exit( 0 );
|
||||||
}
|
}
|
||||||
signal( SIGHUP, SIG_IGN );
|
signal( SIGHUP, SIG_IGN );
|
||||||
cat( 0, sockfd );
|
close( STDOUT_FILENO );
|
||||||
shutdown( sockfd, 1 );
|
cat( STDIN_FILENO, sockfd );
|
||||||
|
shutdown( sockfd, SHUT_WR /* = 1 */ );
|
||||||
|
close( STDIN_FILENO );
|
||||||
waitpid( pid, NULL, 0 );
|
waitpid( pid, NULL, 0 );
|
||||||
exit( 0 );
|
exit( 0 );
|
||||||
}
|
}
|
||||||
@ -367,9 +370,7 @@ int main( int argc, char *argv[] )
|
|||||||
}
|
}
|
||||||
|
|
||||||
int pid = fork();
|
int pid = fork();
|
||||||
if ( pid == -1 ) {
|
if ( pid == -1 ) die( "%s: fork: %d", argv[0], errno );
|
||||||
die( "%s: fork: %d", argv[0], errno );
|
|
||||||
}
|
|
||||||
if ( pid == 0 ) {
|
if ( pid == 0 ) {
|
||||||
close( pty );
|
close( pty );
|
||||||
if ( -1 == dup2( pty_slave, 1 ) ||
|
if ( -1 == dup2( pty_slave, 1 ) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user