Plug sendfile(2) on a listening socket with proper error code.

Reported by:	ngie
Reviewed by:	ngie
Approved by:	re (delphij)
This commit is contained in:
glebius 2018-10-16 15:57:16 +00:00
parent ac81f2f2c7
commit 7e66c109f2

View File

@ -526,6 +526,8 @@ 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 (SOLISTENING(*so))
return (ENOTCONN);
return (0);
}