summaryrefslogtreecommitdiffstats
path: root/tty.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-02-24 19:08:39 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-02-24 19:08:39 +0000
commitf1dd95650b6a193498b2a61694c57fb232ea41bd (patch)
tree44f5b98f51942e5204fe58a74413b1ae3ff8864b /tty.c
parent6767072c9d4774e8e44d7222c01ecee08a35dad8 (diff)
Don't set the terminal to nonblocking on detach until we have finished with it
entirely.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/tty.c b/tty.c
index 02ceb54e..52d3803a 100644
--- a/tty.c
+++ b/tty.c
@@ -213,10 +213,6 @@ tty_stop_tty(struct tty *tty)
* because the fd is invalid. Things like ssh -t can easily leave us
* with a dead tty.
*/
- if ((mode = fcntl(tty->fd, F_GETFL)) == -1)
- return;
- if (fcntl(tty->fd, F_SETFL, mode & ~O_NONBLOCK) == -1)
- return;
if (ioctl(tty->fd, TIOCGWINSZ, &ws) == -1)
return;
if (tcsetattr(tty->fd, TCSANOW, &tty->tio) == -1)
@@ -233,6 +229,9 @@ tty_stop_tty(struct tty *tty)
tty_raw(tty, "\033[?1000l");
tty_raw(tty, tty_term_string(tty->term, TTYC_RMCUP));
+
+ if ((mode = fcntl(tty->fd, F_GETFL)) != -1)
+ fcntl(tty->fd, F_SETFL, mode & ~O_NONBLOCK);
}
void