diff options
author | silby <silby@FreeBSD.org> | 2004-04-08 07:14:34 +0000 |
---|---|---|
committer | silby <silby@FreeBSD.org> | 2004-04-08 07:14:34 +0000 |
commit | d35a5d60b9bfab2480aec8538a44fa0672fffdc8 (patch) | |
tree | 6bfadd567750cec01ed1821d574b3728fa4551aa | |
parent | 9584da2d1fe1984c53c4fe82ce894cee2046919b (diff) | |
download | FreeBSD-src-d35a5d60b9bfab2480aec8538a44fa0672fffdc8.zip FreeBSD-src-d35a5d60b9bfab2480aec8538a44fa0672fffdc8.tar.gz |
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
-rw-r--r-- | sys/kern/uipc_syscalls.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 3a07991..b5ab1de 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1804,8 +1804,14 @@ retry_lookup: 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. |