summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/tty.c7
-rw-r--r--sys/kern/tty_pty.c10
2 files changed, 7 insertions, 10 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 45a386b32f1..fa82a3db1ca 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.100 2013/10/04 17:52:55 millert Exp $ */
+/* $OpenBSD: tty.c,v 1.101 2013/10/06 01:10:53 millert Exp $ */
/* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */
/*-
@@ -1065,10 +1065,7 @@ ttpoll(dev_t device, int events, struct proc *p)
!ISSET(tp->t_state, TS_CARR_ON)))
revents |= events & (POLLIN | POLLRDNORM);
}
- /* NOTE: POLLHUP and POLLOUT/POLLWRNORM are mutually exclusive */
- if (!ISSET(tp->t_cflag, CLOCAL) && !ISSET(tp->t_state, TS_CARR_ON)) {
- revents |= POLLHUP;
- } else if (events & (POLLOUT | POLLWRNORM)) {
+ if (events & (POLLOUT | POLLWRNORM)) {
if (tp->t_outq.c_cc <= tp->t_lowat)
revents |= events & (POLLOUT | POLLWRNORM);
}
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index fa386ef4a66..ba902675545 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_pty.c,v 1.60 2013/10/04 17:52:55 millert Exp $ */
+/* $OpenBSD: tty_pty.c,v 1.61 2013/10/06 01:10:53 millert Exp $ */
/* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */
/*
@@ -615,6 +615,9 @@ ptcpoll(dev_t dev, int events, struct proc *p)
struct tty *tp = pti->pt_tty;
int revents = 0, s;
+ if (!ISSET(tp->t_state, TS_CARR_ON))
+ return (POLLHUP);
+
if (!ISSET(tp->t_state, TS_ISOPEN))
goto notopen;
@@ -629,10 +632,7 @@ ptcpoll(dev_t dev, int events, struct proc *p)
revents |= events & (POLLIN | POLLRDNORM);
splx(s);
}
- /* NOTE: POLLHUP and POLLOUT/POLLWRNORM are mutually exclusive */
- if (!ISSET(tp->t_state, TS_CARR_ON)) {
- revents |= POLLHUP;
- } else if (events & (POLLOUT | POLLWRNORM)) {
+ if (events & (POLLOUT | POLLWRNORM)) {
if ((pti->pt_flags & PF_REMOTE) ?
(tp->t_canq.c_cc == 0) :
((tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG(tp) - 2) ||