httpd: round down sendfile byte count to 64k

*: style fixes
This commit is contained in:
Denis Vlasenko 2007-08-13 11:09:30 +00:00
parent f5635f4d32
commit 319f8ebef8
5 changed files with 8 additions and 7 deletions

View File

@ -1395,7 +1395,8 @@ static int sendFile(const char *url)
fd++; /* write to fd #1 in inetd mode */
#if ENABLE_FEATURE_HTTPD_USE_SENDFILE
do {
count = sendfile(fd, f, &offset, MAXINT(ssize_t));
/* byte count is rounded down to 64k */
count = sendfile(fd, f, &offset, MAXINT(ssize_t) - 0xffff);
if (count < 0) {
if (offset == 0)
goto fallback;