diff options
author | Tiago Cunha <tcunha@gmx.com> | 2010-02-26 13:34:15 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2010-02-26 13:34:15 +0000 |
commit | 862b89b78b70396c237e805445563eb22b74dc40 (patch) | |
tree | 358c2b4b9d57901624cd4b83492560a8eda07eb9 /tty.c | |
parent | 5920a55a870cc0bb2e572eb04fb99319b86d7e11 (diff) | |
download | rtmux-862b89b78b70396c237e805445563eb22b74dc40.tar.gz rtmux-862b89b78b70396c237e805445563eb22b74dc40.tar.bz2 rtmux-862b89b78b70396c237e805445563eb22b74dc40.zip |
Sync OpenBSD patchset 654:
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.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.187 2010-02-02 23:56:25 tcunha Exp $ */ +/* $Id: tty.c,v 1.188 2010-02-26 13:34:15 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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 |