aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/sys_generic.c
diff options
context:
space:
mode:
authorBruce M Simpson <bms@FreeBSD.org>2007-03-01 19:20:25 +0000
committerBruce M Simpson <bms@FreeBSD.org>2007-03-01 19:20:25 +0000
commit6f7ca813c4c223d95a2539d0a9b26e127cdf7a18 (patch)
tree56bc10fa27bb327bbf3d4ec512a033cc2bec73e4 /sys/kern/sys_generic.c
parentdf7babd68930c6d8c0855fb20234e7714f286526 (diff)
downloadsrc-6f7ca813c4c223d95a2539d0a9b26e127cdf7a18.tar.gz
src-6f7ca813c4c223d95a2539d0a9b26e127cdf7a18.zip
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
Notes
Notes: svn path=/head/; revision=167150
Diffstat (limited to 'sys/kern/sys_generic.c')
-rw-r--r--sys/kern/sys_generic.c2
1 files changed, 1 insertions, 1 deletions
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);