match sendfile() error handling to send().
Sendfile() should match the error checking order of send() which is currently: SBS_CANTSENDMORE so_error SS_ISCONNECTED Submitted by: Jason Eggleston <jason@eggnet.com> Reviewed by: glebius MFC after: 2 weeks Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D12633
This commit is contained in:
parent
4887fa3635
commit
1f9916ed08
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=324508
@ -507,8 +507,6 @@ 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_state & SS_ISCONNECTED) == 0)
|
||||
return (ENOTCONN);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -617,6 +615,12 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio,
|
||||
SOCKBUF_UNLOCK(&so->so_snd);
|
||||
goto done;
|
||||
}
|
||||
if ((so->so_state & SS_ISCONNECTED) == 0) {
|
||||
SOCKBUF_UNLOCK(&so->so_snd);
|
||||
error = ENOTCONN;
|
||||
goto done;
|
||||
}
|
||||
|
||||
space = sbspace(&so->so_snd);
|
||||
if (space < rem &&
|
||||
(space <= 0 ||
|
||||
|
Loading…
Reference in New Issue
Block a user