From: Jo-Philipp Wich Date: Sun, 18 Jan 2015 15:07:04 +0000 (+0100) Subject: Build with largefile support X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuhttpd.git;a=commitdiff_plain;h=d9ac7320c80a4629d678fbd905defa831094434c Build with largefile support Signed-off-by: Jo-Philipp Wich --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ec45c52..8c285dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ PROJECT(uhttpd C) INCLUDE (CheckFunctionExists) SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -ADD_DEFINITIONS(-Os -Wall -Werror -Wmissing-declarations --std=gnu99 -g3) +ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 -Os -Wall -Werror -Wmissing-declarations --std=gnu99 -g3) OPTION(TLS_SUPPORT "TLS support" ON) OPTION(LUA_SUPPORT "Lua support" ON) diff --git a/file.c b/file.c index 60dfdfa..73e5a5f 100644 --- a/file.c +++ b/file.c @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -287,10 +288,8 @@ static const char * uh_file_mime_lookup(const char *path) static const char * uh_file_mktag(struct stat *s, char *buf, int len) { - snprintf(buf, len, "\"%x-%x-%x\"", - (unsigned int) s->st_ino, - (unsigned int) s->st_size, - (unsigned int) s->st_mtime); + snprintf(buf, len, "\"%" PRIx64 "-%" PRIx64 "-%" PRIx64 "\"", + s->st_ino, s->st_size, s->st_mtime); return buf; } @@ -580,7 +579,7 @@ static void uh_file_data(struct client *cl, struct path_info *pi, int fd) ustream_printf(cl->us, "Content-Type: %s\r\n", uh_file_mime_lookup(pi->name)); - ustream_printf(cl->us, "Content-Length: %i\r\n\r\n", + ustream_printf(cl->us, "Content-Length: %" PRIu64 "\r\n\r\n", pi->stat.st_size);