mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
linux sendfile: Fix handling of non-blocking sockets
FreeBSD sendfile() may perform a partial transfer and return EAGAIN if the socket is non-blocking. Linux sendfile() expects no error in this case, so squash EAGAIN. PR: 282495 Tested by: pieter@krikkit.xyz MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47447
This commit is contained in:
parent
0a897e6754
commit
a43b745aaf
1 changed files with 7 additions and 0 deletions
|
|
@ -2538,6 +2538,13 @@ sendfile_sendfile(struct thread *td, struct file *fp, l_int out,
|
|||
current_offset = *offset;
|
||||
error = fo_sendfile(fp, out, NULL, NULL, current_offset, count,
|
||||
sbytes, 0, td);
|
||||
if (error == EAGAIN && *sbytes > 0) {
|
||||
/*
|
||||
* The socket is non-blocking and we didn't finish sending.
|
||||
* Squash the error, since that's what Linux does.
|
||||
*/
|
||||
error = 0;
|
||||
}
|
||||
if (error == 0) {
|
||||
current_offset += *sbytes;
|
||||
if (offset != NULL)
|
||||
|
|
|
|||
Loading…
Reference in a new issue