commit 329c4705969983805541d9ed754313574b86ace1
parent 67859a6401f2b7e4daf11067aa188c4f6f669432
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Tue, 9 Jun 2015 19:34:14 +0000
response.c: file_reader(): add support for Linux hosts with 64-bit seek, but with 32-bit off_t (Android)
Diffstat:
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -608,7 +608,7 @@ AM_CONDITIONAL(HAVE_SPDYLAY, [test "x$have_spdylay" = "xyes"])
# large file support (> 4 GB)
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
-AC_CHECK_FUNCS([_lseeki64])
+AC_CHECK_FUNCS([_lseeki64 lseek64])
# optional: have error messages ?
AC_MSG_CHECKING(whether to generate error messages)
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
@@ -329,7 +329,10 @@ file_reader (void *cls, uint64_t pos, char *buf, size_t max)
if (offset64 < 0)
return MHD_CONTENT_READER_END_WITH_ERROR; /* seek to required position is not possible */
-#if defined(HAVE___LSEEKI64)
+#if defined(HAVE_LSEEK64)
+ if (lseek64 (response->fd, offset64, SEEK_SET) != offset64)
+ return MHD_CONTENT_READER_END_WITH_ERROR; /* can't seek to required position */
+#elif defined(HAVE___LSEEKI64)
if (_lseeki64 (response->fd, offset64, SEEK_SET) != offset64)
return MHD_CONTENT_READER_END_WITH_ERROR; /* can't seek to required position */
#else /* !HAVE___LSEEKI64 */