1
0
mirror of https://github.com/tmate-io/tmate-ssh-server.git synced 2020-11-18 19:53:51 -08:00

Don't die if tcsetattr fails; fixes problems with cwm.

This commit is contained in:
Nicholas Marriott 2008-10-27 20:13:37 +00:00
parent 93de57d83f
commit 08e615a03a

15
tty.c
View File

@ -1,4 +1,4 @@
/* $Id: tty.c,v 1.47 2008-10-09 22:03:36 nicm Exp $ */
/* $Id: tty.c,v 1.48 2008-10-27 20:13:37 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -204,16 +204,17 @@ tty_close(struct tty *tty)
}
/*
* Skip any writing if the fd is invalid. Things like ssh -t can
* easily leave us with a dead tty.
* Be flexible about error handling and try not kill the server just
* because the fd is invalid. Things like ssh -t can easily leave us
* with a dead tty.
*/
if (ioctl(tty->fd, TIOCGWINSZ, &ws) == -1) {
if (errno != EBADF && errno != ENXIO)
if (errno != EBADF && errno != ENXIO && errno != ENOTTY)
fatal("ioctl(TIOCGWINSZ)");
} else {
if (tcsetattr(tty->fd, TCSANOW, &tty->tio) != 0)
} else if (tcsetattr(tty->fd, TCSANOW, &tty->tio) == -1) {
if (errno != EBADF && errno != ENXIO && errno != ENOTTY)
fatal("tcsetattr failed");
} else {
tty_raw(tty, tparm(change_scroll_region, 0, ws.ws_row - 1));
if (exit_alt_charset_mode != NULL)
tty_puts(tty, exit_alt_charset_mode);