summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2014-11-17 00:59:45 +0000
committerkib <kib@FreeBSD.org>2014-11-17 00:59:45 +0000
commit942f0f69dcf7f511ab25b34778b0ba7973e9657a (patch)
tree2797b5e44d4bc3c1096e6dee0459bd4e7edbafa4 /sys/kern
parentcaa11c2b5a2cd8438aa70305214215e2c9e2f4bb (diff)
downloadFreeBSD-src-942f0f69dcf7f511ab25b34778b0ba7973e9657a.zip
FreeBSD-src-942f0f69dcf7f511ab25b34778b0ba7973e9657a.tar.gz
MFC r274023:
When other end of the pipe closed during the write, but some bytes were written, return short write instead of EPIPE.
Diffstat (limited to 'sys/kern')
-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 f3c3c0e..9ee4fde 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -1293,13 +1293,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);
OpenPOWER on IntegriCloud