pipe: fix EOF case for non-blocking fds

In particular unbreaks 'go build'.
This commit is contained in:
Mateusz Guzik 2022-08-18 21:23:53 +00:00
parent 8d37116489
commit 545db925c3

View File

@ -734,9 +734,8 @@ pipe_read(struct file *fp, struct uio *uio, struct ucred *active_cred,
if ((fp->f_flag & FNONBLOCK) != 0 && !mac_pipe_check_read_enabled()) {
if (__predict_false(uio->uio_resid == 0))
return (0);
if ((atomic_load_short(&rpipe->pipe_state) & PIPE_EOF) != 0)
return (0);
if (atomic_load_int(&rpipe->pipe_buffer.cnt) == 0 &&
if ((atomic_load_short(&rpipe->pipe_state) & PIPE_EOF) == 0 &&
atomic_load_int(&rpipe->pipe_buffer.cnt) == 0 &&
atomic_load_int(&rpipe->pipe_pages.cnt) == 0)
return (EAGAIN);
}