svn commit: r324405 - head/sys/kern
Sean Bruno
sbruno at FreeBSD.org
Sat Oct 7 23:30:59 UTC 2017
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 at 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);
More information about the svn-src-head
mailing list