Date: Sat, 7 Oct 2017 23:30:57 +0000 (UTC) From: Sean Bruno <sbruno@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324405 - head/sys/kern Message-ID: <201710072330.v97NUv7E040636@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sbruno Date: Sat Oct 7 23:30:57 2017 New Revision: 324405 URL: https://svnweb.freebsd.org/changeset/base/324405 Log: Check so_error early in sendfile() call. Prior to this patch, if a connection was reset by the remote end, sendfile() would just report ENOTCONN instead of ECONNRESET. Submitted by: Jason Eggleston <jason@eggnet.com> Reviewed by: glebius Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D12575 Modified: head/sys/kern/kern_sendfile.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Sat Oct 7 23:10:16 2017 (r324404) +++ head/sys/kern/kern_sendfile.c Sat Oct 7 23:30:57 2017 (r324405) @@ -514,6 +514,11 @@ sendfile_getsock(struct thread *td, int s, struct file *so = (*sock_fp)->f_data; if ((*so)->so_type != SOCK_STREAM) return (EINVAL); + if ((*so)->so_error) { + error = (*so)->so_error; + (*so)->so_error = 0; + return (error); + } if (((*so)->so_state & SS_ISCONNECTED) == 0) return (ENOTCONN); return (0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710072330.v97NUv7E040636>