From 7fedc43305ca09452606f8d010febf0db3673094 Mon Sep 17 00:00:00 2001 From: visa Date: Tue, 14 Dec 2021 15:53:42 +0000 Subject: [PATCH] Remember to clear __EV_HUP when the other end of the FIFO has re-opened. --- sys/miscfs/fifofs/fifo_vnops.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c index d95f34e5a13..1ac3a990132 100644 --- a/sys/miscfs/fifofs/fifo_vnops.c +++ b/sys/miscfs/fifofs/fifo_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fifo_vnops.c,v 1.89 2021/12/13 14:56:55 visa Exp $ */ +/* $OpenBSD: fifo_vnops.c,v 1.90 2021/12/14 15:53:42 visa Exp $ */ /* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */ /* @@ -584,10 +584,12 @@ filt_fiforead_common(struct knote *kn, struct socket *so) if (kn->kn_flags & __EV_POLL) { if (so->so_state & SS_ISDISCONNECTED) kn->kn_flags |= __EV_HUP; + else + kn->kn_flags &= ~__EV_HUP; } rv = 1; } else { - kn->kn_flags &= ~EV_EOF; + kn->kn_flags &= ~(EV_EOF | __EV_HUP); rv = (kn->kn_data > 0); } @@ -712,6 +714,8 @@ filt_fifoexcept_common(struct knote *kn, struct socket *so) if (so->so_state & SS_ISDISCONNECTED) { kn->kn_flags |= __EV_HUP; rv = 1; + } else { + kn->kn_flags &= ~__EV_HUP; } } -- 2.20.1