Date: Mon, 27 Apr 2020 15:58:56 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360378 - head/sys/kern Message-ID: <202004271558.03RFwuti076621@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Mon Apr 27 15:58:55 2020 New Revision: 360378 URL: https://svnweb.freebsd.org/changeset/base/360378 Log: Avoid returning POLLIN if the pipe descriptor is not open for reading. Submitted by: Jan Kokemüller <jan.kokemueller@gmail.com> MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24528 Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Mon Apr 27 14:35:39 2020 (r360377) +++ head/sys/kern/sys_pipe.c Mon Apr 27 15:58:55 2020 (r360378) @@ -1430,7 +1430,8 @@ pipe_poll(struct file *fp, int events, struct ucred *a if ((events & POLLINIGNEOF) == 0) { if (rpipe->pipe_state & PIPE_EOF) { - revents |= (events & (POLLIN | POLLRDNORM)); + if (fp->f_flag & FREAD) + revents |= (events & (POLLIN | POLLRDNORM)); if (wpipe->pipe_present != PIPE_ACTIVE || (wpipe->pipe_state & PIPE_EOF)) revents |= POLLHUP;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004271558.03RFwuti076621>