diff options
author | bms <bms@FreeBSD.org> | 2007-03-01 19:20:25 +0000 |
---|---|---|
committer | bms <bms@FreeBSD.org> | 2007-03-01 19:20:25 +0000 |
commit | 62de975b4dd173f6b7bf54718b6fab2809bec4fb (patch) | |
tree | 56bc10fa27bb327bbf3d4ec512a033cc2bec73e4 | |
parent | b22fc5713d7905326dc216da00e8cd15f590b1ea (diff) | |
download | FreeBSD-src-62de975b4dd173f6b7bf54718b6fab2809bec4fb.zip FreeBSD-src-62de975b4dd173f6b7bf54718b6fab2809bec4fb.tar.gz |
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
-rw-r--r-- | sys/kern/sys_generic.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 841b8e0..8d90d30 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); |