summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranton <anton@openbsd.org>2019-03-11 17:13:31 +0000
committeranton <anton@openbsd.org>2019-03-11 17:13:31 +0000
commit3bef1a3e204f52aa755b8d001f51f99e9b75ac2f (patch)
tree9bd12256e10893e27563ff12b08fb055af01822c
parentDo not unconditionally wait for read events on the pty associated with a (diff)
downloadwireguard-openbsd-3bef1a3e204f52aa755b8d001f51f99e9b75ac2f.tar.xz
wireguard-openbsd-3bef1a3e204f52aa755b8d001f51f99e9b75ac2f.zip
Bring back revision 1.91 now that vmd has been fixed, repeating the
previous commit message: When closing the slave end of a pty, generate an EOF event to any kqueue consumer of the master end. This behavior is equivalent to how pipes already behave with kqueue. Also, FreeBSD and NetBSD behaves the same way. ok deraadt@ millert@ visa@
-rw-r--r--sys/kern/tty_pty.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index 51daa1385a4..f09fb28df82 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_pty.c,v 1.92 2019/03/06 09:36:27 tb Exp $ */
+/* $OpenBSD: tty_pty.c,v 1.93 2019/03/11 17:13:31 anton Exp $ */
/* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */
/*
@@ -678,6 +678,12 @@ filt_ptcread(struct knote *kn, long hint)
((pti->pt_flags & PF_UCNTL) && pti->pt_ucntl))
kn->kn_data++;
}
+
+ if (!ISSET(tp->t_state, TS_CARR_ON)) {
+ kn->kn_flags |= EV_EOF;
+ return (1);
+ }
+
return (kn->kn_data > 0);
}