commit b9ab6ad0312d009e01afd96c90e50ecd0b631c07
parent f6c78e2e11d179c057d134e60d810b542f714ea2
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 16 Jul 2015 09:37:46 +0000
-fix sendfile arg calculation
Diffstat:
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
@@ -1116,16 +1116,14 @@ send_param_adapter (struct MHD_Connection *connection,
#endif /* HAVE_SENDFILE64 */
offsetu64 = connection->response_write_position + connection->response->fd_off;
left = connection->response->total_size - connection->response_write_position;
- if (i > left)
- i = left;
#ifndef HAVE_SENDFILE64
offset = (off_t) offsetu64;
if ( (offsetu64 <= (uint64_t)OFF_T_MAX) &&
- 0 < (ret = sendfile (connection->socket_fd, fd, &offset, i)))
+ 0 < (ret = sendfile (connection->socket_fd, fd, &offset, left)))
#else /* HAVE_SENDFILE64 */
offset = (off64_t) offsetu64;
if ( (offsetu64 <= (uint64_t)OFF64_T_MAX) &&
- 0 < (ret = sendfile64 (connection->socket_fd, fd, &offset, i)))
+ 0 < (ret = sendfile64 (connection->socket_fd, fd, &offset, left)))
#endif /* HAVE_SENDFILE64 */
{
#if EPOLL_SUPPORT