diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -566,12 +566,6 @@ if (auio->uio_resid != cnt && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) error = 0; - /* Socket layer is responsible for issuing SIGPIPE. */ - if (fp->f_type != DTYPE_SOCKET && error == EPIPE) { - PROC_LOCK(td->td_proc); - tdsignal(td, SIGPIPE); - PROC_UNLOCK(td->td_proc); - } } cnt -= auio->uio_resid; #ifdef KTRACE diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1080,14 +1080,15 @@ (wpipe->pipe_state & PIPE_EOF)) { pipeunlock(wpipe); PIPE_UNLOCK(rpipe); - return (EPIPE); + error = EPIPE; + goto out; } #ifdef MAC error = mac_pipe_check_write(active_cred, wpipe->pipe_pair); if (error) { pipeunlock(wpipe); PIPE_UNLOCK(rpipe); - return (error); + goto out; } #endif ++wpipe->pipe_busy; @@ -1318,6 +1319,9 @@ PIPE_UNLOCK(rpipe); if (uio->uio_resid != orig_resid) td->td_ru.ru_msgsnd++; +out: + if (error == EPIPE) + tdsignal(td, SIGPIPE); return (error); }