Permalink
Browse files

Set width and height to 0 if the console is not a TTY

  • Loading branch information...
StellaTeam committed Jul 3, 2018
1 parent e46b83c commit d80456545ee4e3689b33a3884d49b0d9068adb2b
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/mactelnet.c
@@ -245,10 +245,14 @@ static void send_auth(char *username, char *password) {
if (is_a_tty && get_terminal_size(&width, &height) != -1) {
width = htole16(width);
height = htole16(height);
plen += add_control_packet(&data, MT_CPTYPE_TERM_WIDTH, &width, 2);
plen += add_control_packet(&data, MT_CPTYPE_TERM_HEIGHT, &height, 2);
} else {
width = 0;
height = 0;
}
plen += add_control_packet(&data, MT_CPTYPE_TERM_WIDTH, &width, 2);
plen += add_control_packet(&data, MT_CPTYPE_TERM_HEIGHT, &height, 2);
outcounter += plen;
/* TODO: handle result */

0 comments on commit d804565

Please sign in to comment.