Exit gracefully on pty write or ioctl failure.

Fixes #821, OS X abnormal exit on client input at mosh-server
shutdown.  On OpenIndiana, TIOCG[GS]WINSZ also fail in this situation.
This commit is contained in:
John Hood
2016-11-05 19:40:30 -04:00
parent 4bc9e5c6ab
commit 22f5d58144
+3 -3
View File
@@ -700,13 +700,13 @@ static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &
struct winsize window_size;
if ( ioctl( host_fd, TIOCGWINSZ, &window_size ) < 0 ) {
perror( "ioctl TIOCGWINSZ" );
return;
network.start_shutdown();
}
window_size.ws_col = res->width;
window_size.ws_row = res->height;
if ( ioctl( host_fd, TIOCSWINSZ, &window_size ) < 0 ) {
perror( "ioctl TIOCSWINSZ" );
return;
network.start_shutdown();
}
}
terminal_to_host += terminal.act( action );
@@ -782,7 +782,7 @@ static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &
/* write user input and terminal writeback to the host */
if ( swrite( host_fd, terminal_to_host.c_str(), terminal_to_host.length() ) < 0 ) {
break;
network.start_shutdown();
}
bool idle_shutdown = false;