Check the far end before registering an EVFILT_WRITE filter on a pipe.
This commit is contained in:
parent
28c4ea6da8
commit
ea4c8f8ca1
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user