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 <[email protected]> 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); _______________________________________________ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "[email protected]"
