Project

General

Profile

Bug #2753

mod_deflate backport compile error if ENABLE_MMAP not defined

Added by benkfra 9 months ago. Updated 9 months ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
mod_deflate
Target version:
Start date:
2016-09-22
Due date:
% Done:

100%

Estimated time:
Missing in 1.5.x:

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.

Associated revisions

Revision cb1a3c62 (diff)
Added by gstrauss 9 months ago

backport mod_deflate to lighttpd 1.4 (fixes #1824, fixes #2753)

lots of fixes and improvements

limitations: see comments at top of mod_deflate.c

missing functionality: encode streaming response
(module currently requires response be collected before being sent)

potential functionality: addition of compressed file cache would
allow mod_deflate to fully supplant mod_compress in lighttpd 1.4.x

x-ref:
"Adding mod_deflate to 1.4.xx"
https://redmine.lighttpd.net/issues/1824
"mod_deflate backport compile error if ENABLE_MMAP not defined"
https://redmine.lighttpd.net/issues/2753

github: closes #67

History

#1 Updated by gstrauss 9 months 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;

#2 Updated by gstrauss 9 months ago

  • Status changed from Patch Pending to Fixed
  • % Done changed from 0 to 100

Also available in: Atom