lighttpd: streamline Genode specific patches

Issue #5093.
This commit is contained in:
Josef Söntgen 2024-02-06 13:27:10 +01:00 committed by Christian Helmuth
parent 080d3b6b63
commit 914508bf7a
5 changed files with 45 additions and 102 deletions

View File

@ -1 +1 @@
a2d881f54b350c44f5a252bfb4feae666a02c5c5
fe4e04aee96a64815757202aae6812cb64bbcf50

View File

@ -6,4 +6,4 @@ URL(lighttpd) := http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-$
SHA(lighttpd) := 816cbec71e8d02d874f1d5c798d76d091a76d5acbeb6e017ba76aeb4263d6995
DIR(lighttpd) := src/app/lighttpd
PATCHES := $(addprefix src/app/lighttpd/,fd_cloexec.patch mod_webdav.patch)
PATCHES := $(addprefix src/app/lighttpd/,fd_cloexec.patch mod_dirlisting.patch mod_webdav.patch)

View File

@ -1,92 +1,34 @@
--- src/app/lighttpd/src/fdevent.c
+++ src/app/lighttpd/src/fdevent.c
@@ -51,7 +51,7 @@
@@ -11,6 +11,9 @@
#include <errno.h>
#include <fcntl.h>
+#undef FD_CLOEXEC
+#undef F_DUPFD_CLOEXEC
+
#include "ck.h"
#define force_assert(x) ck_assert(x)
--- src/app/lighttpd/src/server.c
+++ src/app/lighttpd/src/server.c
@@ -1397,6 +1397,8 @@
}
#endif
void fdevent_setfd_cloexec(int fd) {
-#ifdef FD_CLOEXEC
+#if 0
if (fd < 0) return;
force_assert(-1 != fcntl(fd, F_SETFD, FD_CLOEXEC));
#else
@@ -60,7 +60,7 @@
}
void fdevent_clrfd_cloexec(int fd) {
-#ifdef FD_CLOEXEC
+#if 0
if (fd >= 0) force_assert(-1 != fcntl(fd, F_SETFD, 0));
#else
UNUSED(fd);
@@ -96,7 +96,7 @@
return socket(domain, type | SOCK_CLOEXEC, protocol);
#endif
if (-1 != (fd = socket(domain, type, protocol))) {
-#ifdef FD_CLOEXEC
+#if 0
force_assert(-1 != fcntl(fd, F_SETFD, FD_CLOEXEC));
#endif
}
@@ -120,7 +120,7 @@
#endif
#endif
if (-1 != (fd = socket(domain, type, protocol))) {
-#ifdef FD_CLOEXEC
+#if 0
force_assert(-1 != fcntl(fd, F_SETFD, FD_CLOEXEC));
#endif
#ifdef O_NONBLOCK
@@ -173,7 +173,7 @@
#endif /* not used */
int fdevent_dup_cloexec (int fd) {
- #ifdef F_DUPFD_CLOEXEC
+ #if 0
return fcntl(fd, F_DUPFD_CLOEXEC, 3);
#else
const int newfd = fcntl(fd, F_DUPFD, 3);
@@ -203,7 +203,7 @@
/* O_CLOEXEC handled further below, if defined) */
#ifdef O_NONBLOCK
#define FDEVENT_O_FLAGS \
- (O_BINARY | O_LARGEFILE | O_NOCTTY | O_NONBLOCK)
+ (O_BINARY | O_LARGEFILE | O_NOCTTY )
#else
#define FDEVENT_O_FLAGS \
(O_BINARY | O_LARGEFILE | O_NOCTTY )
@@ -214,7 +214,7 @@
return open(pathname, flags | O_CLOEXEC | FDEVENT_O_FLAGS, mode);
#else
int fd = open(pathname, flags | FDEVENT_O_FLAGS, mode);
-#ifdef FD_CLOEXEC
+#if 0
if (fd != -1)
force_assert(-1 != fcntl(fd, F_SETFD, FD_CLOEXEC));
#endif
@@ -254,7 +254,7 @@
+#undef FD_CLOEXEC
+
__attribute_cold__
__attribute_noinline__
static int server_main_setup (server * const srv, int argc, char **argv) {
--- src/app/lighttpd/src/configfile.c
+++ src/app/lighttpd/src/configfile.c
@@ -1795,6 +1795,8 @@
#endif
{
if (0 != pipe(fds)
- #ifdef FD_CLOEXEC
+ #if 0
|| 0 != fcntl(fds[0], F_SETFD, FD_CLOEXEC)
|| 0 != fcntl(fds[1], F_SETFD, FD_CLOEXEC)
#endif
@@ -378,7 +378,7 @@
char ** fdevent_environ (void) { return environ; }
}
-#ifdef FD_CLOEXEC
+#if 0
static int fdevent_dup2_close_clrfd_cloexec(int oldfd, int newfd) {
if (oldfd >= 0) {
if (oldfd != newfd) {
@@ -406,7 +406,7 @@
int fdevent_set_stdin_stdout_stderr(int fdin, int fdout, int fderr) {
- #ifdef FD_CLOEXEC
+ #if 0
if (STDIN_FILENO != fdevent_dup2_close_clrfd_cloexec(fdin, STDIN_FILENO))
return -1;
if (STDOUT_FILENO != fdevent_dup2_close_clrfd_cloexec(fdout, STDOUT_FILENO))
+#undef FD_CLOEXEC
+
int config_log_error_open(server *srv) {
/* logs are opened after preflight check (srv->srvconf.preflight_check)
* and after dropping privileges instead of being opened during config

View File

@ -0,0 +1,15 @@
Disable usage of linkat and unlinkat which is not (yet) support
in our libc.
--- src/app/lighttpd/src/mod_dirlisting.c
+++ src/app/lighttpd/src/mod_dirlisting.c
@@ -42,6 +42,9 @@
#endif
#endif
+#undef AT_FDCWD
+#undef _ATFILE_SOURCE
+
#ifdef _WIN32
#include <windows.h>
#include <stringapiset.h>

View File

@ -11,43 +11,29 @@ FILTER_OUT := lempar.c lighttpd-angel.c lemon.c \
mod_authn_pam.c \
mod_authn_sasl.c \
mod_cgi.c \
mod_cml.c \
mod_cml_funcs.c \
mod_cml_lua.c \
mod_compress.c \
mod_deflate.c \
mod_evasive.c \
mod_evhost.c \
mod_expire.c \
mod_extforward.c \
mod_fastcgi.c \
mod_flv_streaming.c \
mod_geoip.c \
mod_gnutls.c \
mod_magnet.c \
mod_magnet_cache.c \
mod_maxminddb.c \
mod_mbedtls.c \
mod_mysql_vhost.c \
mod_nss.c \
mod_proxy.c \
mod_redirect.c \
mod_rewrite.c \
mod_rrdtool.c \
mod_scgi.c \
mod_secdownload.c \
mod_setenv.c \
mod_simple_vhost.c \
mod_skeleton.c \
mod_sockproxy.c \
mod_ssi.c \
mod_ssi_expr.c \
mod_ssi_exprparser.c \
mod_status.c \
mod_trigger_b4_dl.c \
mod_uploadprogress.c \
mod_userdir.c \
mod_usertrack.c \
mod_vhostdb.c \
mod_vhostdb_dbi.c \
mod_vhostdb_ldap.c \