Date: Mon, 3 Nov 2014 10:01:57 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r274023 - head/sys/kern Message-ID: <201411031001.sA3A1vY7003611@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Mon Nov 3 10:01:56 2014 New Revision: 274023 URL: https://svnweb.freebsd.org/changeset/base/274023 Log: 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 Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Mon Nov 3 09:26:39 2014 (r274022) +++ head/sys/kern/sys_pipe.c Mon Nov 3 10:01:56 2014 (r274023) @@ -1296,13 +1296,13 @@ pipe_write(fp, uio, active_cred, flags, } /* - * 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411031001.sA3A1vY7003611>