summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2015-02-12 14:31:03 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2015-02-12 14:31:03 +0000
commitff57eb67e9394ddfda077836a7b6e5b126894879 (patch)
tree9fe7358c3d0659df8dc1414ba2d76c9cd29d47f9 /sys
parent76af93654599e453aff97c341bc31bcdb6e7c1b9 (diff)
Fix a bug introduced in the last commit that broke EOF handling
in the normal, blocking case. No longer passes regress but that will be fixed later. OK jca@
Diffstat (limited to 'sys')
-rw-r--r--sys/miscfs/fifofs/fifo_vnops.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c
index b5c86cf0b30..c8977ee0b8a 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.44 2014/12/16 18:30:04 tedu Exp $ */
+/* $OpenBSD: fifo_vnops.c,v 1.45 2015/02/12 14:31:02 millert Exp $ */
/* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */
/*
@@ -227,9 +227,6 @@ fifo_read(void *v)
ap->a_vp->v_fifoinfo->fi_writers == 0)
error = 0;
}
- /* Clear EOF indicator so we have a clean slate for a new writer. */
- if (error == 0)
- rso->so_state &= ~(SS_CANTRCVMORE|SS_ISDISCONNECTED);
return (error);
}
@@ -293,17 +290,21 @@ fifo_poll(void *v)
{
struct vop_poll_args *ap = v;
struct file filetmp;
+ const int events = ap->a_events;
int revents = 0;
- if (ap->a_events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) {
+ if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) {
filetmp.f_data = ap->a_vp->v_fifoinfo->fi_readsock;
if (filetmp.f_data)
- revents |= soo_poll(&filetmp, ap->a_events, ap->a_p);
+ revents |= soo_poll(&filetmp, events, ap->a_p);
}
- if (ap->a_events & (POLLOUT | POLLWRNORM | POLLWRBAND)) {
- filetmp.f_data = ap->a_vp->v_fifoinfo->fi_writesock;
- if (filetmp.f_data)
- revents |= soo_poll(&filetmp, ap->a_events, ap->a_p);
+ /* POLLHUP and POLLOUT/POLLWRNORM/POLLWRBAND are mutually exclusive */
+ if (!(revents & POLLHUP)) {
+ if (events & (POLLOUT | POLLWRNORM | POLLWRBAND)) {
+ filetmp.f_data = ap->a_vp->v_fifoinfo->fi_writesock;
+ if (filetmp.f_data)
+ revents |= soo_poll(&filetmp, events, ap->a_p);
+ }
}
return (revents);
}