MFC r274023:

When other end of the pipe closed during the write, but some bytes
were written, return short write instead of EPIPE.
This commit is contained in:
kib 2014-11-17 00:59:45 +00:00
parent caa11c2b5a
commit 942f0f69dc

View File

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