Check the far end before registering an EVFILT_WRITE filter on a pipe.

This commit is contained in:
Dag-Erling Smørgrav 2002-08-05 15:03:03 +00:00
parent 28c4ea6da8
commit ea4c8f8ca1

View File

@ -1372,6 +1372,9 @@ pipe_kqfilter(struct file *fp, struct knote *kn)
case EVFILT_WRITE:
kn->kn_fop = &pipe_wfiltops;
cpipe = cpipe->pipe_peer;
if (cpipe == NULL)
/* other end of pipe has been closed */
return (EBADF);
break;
default:
return (1);