1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-01 12:19:28 +00:00

Fix a regression in my change which sends headers along with data; a

side effect of that change caused headers to not be sent if a 0 byte
file was passed to sendfile.  This change fixes that behavior, allowing
sendfile to send out the headers even with a 0 byte file again.

Noticed by:	Dirk Engling
This commit is contained in:
Mike Silbersack 2004-04-08 07:14:34 +00:00
parent ece267ba58
commit e8410540b7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=128031

View File

@ -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.