From 6f7ca813c4c223d95a2539d0a9b26e127cdf7a18 Mon Sep 17 00:00:00 2001 From: Bruce M Simpson Date: Thu, 1 Mar 2007 19:20:25 +0000 Subject: [PATCH] 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 --- sys/kern/sys_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 841b8e0beb50..8d90d300140d 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -489,7 +489,7 @@ dofilewrite(td, fd, fp, auio, offset, flags) error == EINTR || error == EWOULDBLOCK)) error = 0; /* Socket layer is responsible for issuing SIGPIPE. */ - if (error == EPIPE) { + if (fp->f_type != DTYPE_SOCKET && error == EPIPE) { PROC_LOCK(td->td_proc); psignal(td->td_proc, SIGPIPE); PROC_UNLOCK(td->td_proc);