aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/sys_pipe.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2014-11-03 10:01:56 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2014-11-03 10:01:56 +0000
commitab57474c8307a05441f162752cc9ae549bf15dae (patch)
treef4845a5d86e88275d2056c6a50ded95835711b65 /sys/kern/sys_pipe.c
parente5f33ae3e70dd1b5f5266067635dde924a786017 (diff)
downloadsrc-ab57474c8307a05441f162752cc9ae549bf15dae.tar.gz
src-ab57474c8307a05441f162752cc9ae549bf15dae.zip
When other end of the pipe closed during the write, but some bytes
were written, return short write instead of EPIPE. Update comment. Discussed with: bde (long time ago) MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=274023
Diffstat (limited to 'sys/kern/sys_pipe.c')
-rw-r--r--sys/kern/sys_pipe.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index b39c4fe2e247..22386e832793 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -1296,13 +1296,13 @@ pipe_write(fp, uio, active_cred, flags, td)
}
/*
- * Don't return EPIPE if I/O was successful
+ * Don't return EPIPE if any byte was written.
+ * EINTR and other interrupts are handled by generic I/O layer.
+ * Do not pretend that I/O succeeded for obvious user error
+ * like EFAULT.
*/
- if ((wpipe->pipe_buffer.cnt == 0) &&
- (uio->uio_resid == 0) &&
- (error == EPIPE)) {
+ if (uio->uio_resid != orig_resid && error == EPIPE)
error = 0;
- }
if (error == 0)
vfs_timestamp(&wpipe->pipe_mtime);