From 61181d7df2ee94296cc70ee375bcffb2a03b8599 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Sat, 15 Oct 1994 17:59:02 +0000 Subject: [PATCH] ttywait: check conditions again right after oproc Obtained from: (I know, but can't say :-) --- sys/kern/tty.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/kern/tty.c b/sys/kern/tty.c index fb45cb958e97..254708556470 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)tty.c 8.8 (Berkeley) 1/21/94 - * $Id: tty.c,v 1.9 1994/10/06 21:06:34 davidg Exp $ + * $Id: tty.c,v 1.10 1994/10/08 22:33:39 phk Exp $ */ #include @@ -980,10 +980,13 @@ ttywait(tp) (ISSET(tp->t_state, TS_CARR_ON) || ISSET(tp->t_cflag, CLOCAL)) && tp->t_oproc) { (*tp->t_oproc)(tp); - SET(tp->t_state, TS_ASLEEP); - error = ttysleep(tp, &tp->t_outq, TTOPRI | PCATCH, ttyout, 0); - if (error) - break; + if ((tp->t_outq.c_cc || ISSET(tp->t_state, TS_BUSY)) && + (ISSET(tp->t_state, TS_CARR_ON) || ISSET(tp->t_cflag, CLOCAL))) { + SET(tp->t_state, TS_ASLEEP); + error = ttysleep(tp, &tp->t_outq, TTOPRI | PCATCH, ttyout, 0); + if (error) + break; + } } splx(s); return (error);