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
This commit is contained in:
Konstantin Belousov 2014-11-03 10:01:56 +00:00
parent e5f33ae3e7
commit ab57474c83
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=274023

View File

@ -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);