diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2014-11-03 10:01:56 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2014-11-03 10:01:56 +0000 |
commit | ab57474c8307a05441f162752cc9ae549bf15dae (patch) | |
tree | f4845a5d86e88275d2056c6a50ded95835711b65 /sys/kern/sys_pipe.c | |
parent | e5f33ae3e70dd1b5f5266067635dde924a786017 (diff) | |
download | src-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.c | 10 |
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); |