Actions
Bug #2753
closedmod_deflate backport compile error if ENABLE_MMAP not defined
ASK QUESTIONS IN Forums:
Description
When compiling the backport of mod_deflate (sourcetree 1.4.41 with patch https://github.com/lighttpd/lighttpd1.4/pull/67.path) without ENABLE_MMAP defined, the following error will show up:
mod_deflate.c: In function `mod_deflate_file_chunk':
mod_deflate.c:770: error: `MAP_FAILED' undeclared (first use in this function)
I'm not that fmiliar with the code to decide how to fix this. Maybe the
#include "sys-mmap.h"
should not be covered by the conditional compilation or the use of the define in line 770 is a mistake at all.
Updated by gstrauss about 8 years ago
- Status changed from New to Patch Pending
- Target version changed from 1.4.x to 1.4.42
Thanks for pointing it out. Adding #include "sys-mmap.h" is the right thing for portability. chunk.c does the same thing and initialized c->file.mmap.start to MAP_FAILED, whether or not header availability has been checked and USE_MMAP has been set.
diff --git a/src/mod_deflate.c b/src/mod_deflate.c index 8d2695f..8f4c382 100644 --- a/src/mod_deflate.c +++ b/src/mod_deflate.c @@ -100,6 +100,7 @@ #include <sys/types.h> #include <sys/stat.h> +#include "sys-mmap.h" #include <fcntl.h> #include <stdlib.h> @@ -667,8 +668,8 @@ static void deflate_compress_cleanup(server *srv, connection *con, handler_ctx * static int mod_deflate_file_chunk(server *srv, connection *con, handler_ctx *hctx, chunk *c, off_t st_size) { off_t abs_offset; - off_t toSend; - char *start; + off_t toSend = -1; + char *start = NULL; #ifdef USE_MMAP off_t we_want_to_mmap = 2 MByte; off_t we_want_to_send = st_size;
Updated by gstrauss about 8 years ago
- Status changed from Patch Pending to Fixed
- % Done changed from 0 to 100
Applied in changeset cb1a3c6299a5aec932748386ab93616d0cc35229.
Actions
Also available in: Atom