diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 3a079917bd56..b5ab1def746a 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1804,8 +1804,14 @@ do_sendfile(struct thread *td, struct sendfile_args *uap, int compat) xfsize = PAGE_SIZE - pgoff; if (uap->nbytes && xfsize > (uap->nbytes - sbytes)) xfsize = uap->nbytes - sbytes; - if (xfsize <= 0) - break; + if (xfsize <= 0) { + if (m_header != NULL) { + m = m_header; + m_header = NULL; + goto retry_space; + } else + break; + } /* * Optimize the non-blocking case by looking at the socket space * before going to the extra work of constituting the sf_buf.