Index: sys/kern/sys_pipe.c =================================================================== --- sys/kern/sys_pipe.c +++ sys/kern/sys_pipe.c @@ -946,9 +946,10 @@ retry: PIPE_LOCK_ASSERT(wpipe, MA_OWNED); error = pipelock(wpipe, 1); - if (wpipe->pipe_state & PIPE_EOF) + if (error) + goto error1; + if (wpipe->pipe_state & PIPE_EOF) { error = EPIPE; - if (error) { pipeunlock(wpipe); goto error1; }