linux: Fix ENOTSOCK handling in sendfile(2)

The Linux way for sendfile(2) to tell the application
to fallback to another way of copying data is by EINVAL,
not ENOTSOCK.  This fixes package installation scripts
for Mono packages from Focal.

Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D32604
This commit is contained in:
Edward Tomasz Napierala 2021-10-23 09:15:37 +01:00
parent 3417c29851
commit 2c7f798282

View file

@ -2101,6 +2101,8 @@ linux_sendfile_common(struct thread *td, l_int out, l_int in,
td->td_retval[0] = (ssize_t)bytes_read;
drop:
fdrop(fp, td);
if (error == ENOTSOCK)
error = EINVAL;
return (error);
}