Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Nov 2014 00:59:46 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r274609 - stable/10/sys/kern
Message-ID:  <201411170059.sAH0xk8H013438@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Nov 17 00:59:45 2014
New Revision: 274609
URL: https://svnweb.freebsd.org/changeset/base/274609

Log:
  MFC r274023:
  When other end of the pipe closed during the write, but some bytes
  were written, return short write instead of EPIPE.

Modified:
  stable/10/sys/kern/sys_pipe.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/sys_pipe.c
==============================================================================
--- stable/10/sys/kern/sys_pipe.c	Mon Nov 17 00:57:33 2014	(r274608)
+++ stable/10/sys/kern/sys_pipe.c	Mon Nov 17 00:59:45 2014	(r274609)
@@ -1293,13 +1293,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?201411170059.sAH0xk8H013438>