Date: Fri, 13 Nov 2020 13:36:47 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r367637 - stable/12/sys/kern Message-ID: <202011131336.0ADDalsp034139@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Fri Nov 13 13:36:46 2020 New Revision: 367637 URL: https://svnweb.freebsd.org/changeset/base/367637 Log: MFC r367352,r367353: pipe: fix POLLHUP handling if no events were specified pipe: whitespace nit in previous Modified: stable/12/sys/kern/sys_pipe.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/sys_pipe.c ============================================================================== --- stable/12/sys/kern/sys_pipe.c Fri Nov 13 13:18:48 2020 (r367636) +++ stable/12/sys/kern/sys_pipe.c Fri Nov 13 13:36:46 2020 (r367637) @@ -1446,13 +1446,17 @@ pipe_poll(struct file *fp, int events, struct ucred *a } if (revents == 0) { - if (fp->f_flag & FREAD && events & (POLLIN | POLLRDNORM)) { + /* + * Add ourselves regardless of eventmask as we have to return + * POLLHUP even if it was not asked for. + */ + if ((fp->f_flag & FREAD) != 0) { selrecord(td, &rpipe->pipe_sel); if (SEL_WAITING(&rpipe->pipe_sel)) rpipe->pipe_state |= PIPE_SEL; } - if (fp->f_flag & FWRITE && events & (POLLOUT | POLLWRNORM)) { + if ((fp->f_flag & FWRITE) != 0) { selrecord(td, &wpipe->pipe_sel); if (SEL_WAITING(&wpipe->pipe_sel)) wpipe->pipe_state |= PIPE_SEL;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011131336.0ADDalsp034139>