Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 May 2020 15:17:57 +0000 (UTC)
From:      Mark Johnston <markj@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: r360895 - stable/12/sys/kern
Message-ID:  <202005111517.04BFHvoi006132@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Mon May 11 15:17:57 2020
New Revision: 360895
URL: https://svnweb.freebsd.org/changeset/base/360895

Log:
  MFC r360378:
  Avoid returning POLLIN if the pipe descriptor is not open for reading.

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	Mon May 11 08:40:33 2020	(r360894)
+++ stable/12/sys/kern/sys_pipe.c	Mon May 11 15:17:57 2020	(r360895)
@@ -1432,7 +1432,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?202005111517.04BFHvoi006132>