Do not dispatch SIGPIPE from the generic write path for a socket; with

this patch the code behaves according to the comment on the line above.

Without this patch, a socket could cause SIGPIPE to be delivered to its
process, once with SO_NOSIGPIPE set, and twice without.

With this patch, the kernel now passes the sigpipe regression test.

Tested by:	Anton Yuzhaninov
MFC after:	1 week
This commit is contained in:
Bruce M Simpson 2007-03-01 19:20:25 +00:00
parent df7babd689
commit 6f7ca813c4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167150

View file

@ -489,7 +489,7 @@ dofilewrite(td, fd, fp, auio, offset, flags)
error == EINTR || error == EWOULDBLOCK)) error == EINTR || error == EWOULDBLOCK))
error = 0; error = 0;
/* Socket layer is responsible for issuing SIGPIPE. */ /* Socket layer is responsible for issuing SIGPIPE. */
if (error == EPIPE) { if (fp->f_type != DTYPE_SOCKET && error == EPIPE) {
PROC_LOCK(td->td_proc); PROC_LOCK(td->td_proc);
psignal(td->td_proc, SIGPIPE); psignal(td->td_proc, SIGPIPE);
PROC_UNLOCK(td->td_proc); PROC_UNLOCK(td->td_proc);