From 96bf5af1b4e8a8164cc004b942553a8ca88f55df Mon Sep 17 00:00:00 2001 From: Igor Bukanov Date: Tue, 29 Oct 2013 14:41:34 +0100 Subject: [PATCH] mosh-server: allow startup with PTY with zero width or height like Emacs shell. Closes #472 Closes #473 --- src/frontend/mosh-server.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frontend/mosh-server.cc b/src/frontend/mosh-server.cc index d91cbc7..84cf7b6 100644 --- a/src/frontend/mosh-server.cc +++ b/src/frontend/mosh-server.cc @@ -325,7 +325,9 @@ int run_server( const char *desired_ip, const char *desired_port, const int colors, bool verbose, bool with_motd ) { /* get initial window size */ struct winsize window_size; - if ( ioctl( STDIN_FILENO, TIOCGWINSZ, &window_size ) < 0 ) { + if ( ioctl( STDIN_FILENO, TIOCGWINSZ, &window_size ) < 0 || + window_size.ws_col == 0 || + window_size.ws_row == 0 ) { fprintf( stderr, "Server started without pseudo-terminal. Opening 80x24 terminal.\n" ); /* Fill in sensible defaults. */