summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2020-05-21 09:34:07 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2020-05-21 09:34:07 +0000
commit9146f46bdd2b8e8f4d17ba5ddf390cfd21948f11 (patch)
tree394794574800fec74489a37bce1b69cf08e1956e /sys
parent86640f74328336d62120744da6288005ae205bb6 (diff)
Add missing ICANON check in filt_ptcwrite().
ok millert@, visa@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/tty_pty.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index 2152bcde86a..693abddfd29 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_pty.c,v 1.98 2020/04/07 13:27:51 visa Exp $ */
+/* $OpenBSD: tty_pty.c,v 1.99 2020/05/21 09:34:06 mpi Exp $ */
/* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */
/*
@@ -708,7 +708,8 @@ filt_ptcwrite(struct knote *kn, long hint)
if (ISSET(pti->pt_flags, PF_REMOTE)) {
if (tp->t_canq.c_cc == 0)
kn->kn_data = tp->t_canq.c_cn;
- } else if (tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG(tp)-2)
+ } else if ((tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG(tp)-2) ||
+ (tp->t_canq.c_cc == 0 && ISSET(tp->t_lflag, ICANON)))
kn->kn_data = tp->t_canq.c_cn -
(tp->t_rawq.c_cc + tp->t_canq.c_cc);
}