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
This commit is contained in:
parent
095db7e6e7
commit
75c8dfb6ae
@ -514,6 +514,11 @@ sendfile_getsock(struct thread *td, int s, struct file **sock_fp,
|
||||
*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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user