=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tty.c,v retrieving revision 1.95 retrieving revision 1.96 diff -c -r1.95 -r1.96 *** src/usr.bin/tmux/tty.c 2011/01/03 23:35:22 1.95 --- src/usr.bin/tmux/tty.c 2011/01/08 01:52:37 1.96 *************** *** 1,4 **** ! /* $OpenBSD: tty.c,v 1.95 2011/01/03 23:35:22 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: tty.c,v 1.96 2011/01/08 01:52:37 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 165,179 **** tty_start_tty(struct tty *tty) { struct termios tio; - int mode; if (tty->fd == -1) return; ! if ((mode = fcntl(tty->fd, F_GETFL)) == -1) ! fatal("fcntl failed"); ! if (fcntl(tty->fd, F_SETFL, mode|O_NONBLOCK) == -1) ! fatal("fcntl failed"); bufferevent_enable(tty->event, EV_READ|EV_WRITE); --- 165,175 ---- tty_start_tty(struct tty *tty) { struct termios tio; if (tty->fd == -1) return; ! setblocking(tty->fd, 0); bufferevent_enable(tty->event, EV_READ|EV_WRITE); *************** *** 220,226 **** tty_stop_tty(struct tty *tty) { struct winsize ws; - int mode; if (!(tty->flags & TTY_STARTED)) return; --- 216,221 ---- *************** *** 251,258 **** 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 --- 246,252 ---- tty_raw(tty, tty_term_string(tty->term, TTYC_RMCUP)); ! setblocking(tty->fd, 1); } void