[core] silence compiler warnings if !HAVE_FORK

silence compiler warnings if HAVE_FORK is not set

However, if HAVE_FORK is not set, then -Werror was probably passed to
./configure, which is currently a mistake.  lighttpd can successfully
compiles src/ with -Werror on many platforms, but ./configure tests
should not be run with -Werror. [gstrauss]

github: closes #81

x-ref:
   "Fix warnings"
   https://github.com/lighttpd/lighttpd1.4/pull/81
personal/stbuehler/mod-csrf
Gaël PORTAY 6 years ago committed by Glenn Strauss
parent 7a27d5eff5
commit e8498bbfcc

@ -348,6 +348,7 @@ typedef struct {
/* ok, we need a prototype */
static handler_t fcgi_handle_fdevent(server *srv, void *ctx, int revents);
#ifdef HAVE_FORK
static void reset_signals(void) {
#ifdef SIGTTOU
signal(SIGTTOU, SIG_DFL);
@ -362,6 +363,7 @@ static void reset_signals(void) {
signal(SIGPIPE, SIG_DFL);
signal(SIGUSR1, SIG_DFL);
}
#endif /* HAVE_FORK */
static void fastcgi_status_copy_procname(buffer *b, fcgi_extension_host *host, fcgi_proc *proc) {
buffer_copy_string_len(b, CONST_STR_LEN("fastcgi.backend."));
@ -824,6 +826,7 @@ FREE_FUNC(mod_fastcgi_free) {
return HANDLER_GO_ON;
}
#ifdef HAVE_FORK
static int env_add(char_array *env, const char *key, size_t key_len, const char *val, size_t val_len) {
char *dst;
size_t i;
@ -913,6 +916,7 @@ static int parse_binpath(char_array *env, buffer *b) {
return 0;
}
#endif /* HAVE_FORK */
#if !defined(HAVE_FORK)
static int fcgi_spawn_connection(server *srv,

@ -79,12 +79,11 @@ FREE_FUNC(mod_rrd_free) {
free(p->config_storage);
if (p->rrdtool_pid) {
int status;
close(p->read_fd);
close(p->write_fd);
#ifdef HAVE_FORK
/* collect status */
while (-1 == waitpid(p->rrdtool_pid, &status, 0) && errno == EINTR) ;
while (-1 == waitpid(p->rrdtool_pid, NULL, 0) && errno == EINTR) ;
#endif
}
@ -181,6 +180,8 @@ static int mod_rrd_create_pipe(server *srv, plugin_data *p) {
return 0;
#else
UNUSED(srv);
UNUSED(p);
return -1;
#endif
}

@ -327,6 +327,7 @@ static handler_t scgi_handle_fdevent(server *srv, void *ctx, int revents);
int scgi_proclist_sort_down(server *srv, scgi_extension_host *host, scgi_proc *proc);
#ifdef HAVE_FORK
static void reset_signals(void) {
#ifdef SIGTTOU
signal(SIGTTOU, SIG_DFL);
@ -341,6 +342,7 @@ static void reset_signals(void) {
signal(SIGPIPE, SIG_DFL);
signal(SIGUSR1, SIG_DFL);
}
#endif /* HAVE_FORK */
static handler_ctx * handler_ctx_init(void) {
handler_ctx * hctx;
@ -647,6 +649,7 @@ FREE_FUNC(mod_scgi_free) {
return HANDLER_GO_ON;
}
#ifdef HAVE_FORK
static int env_add(char_array *env, const char *key, size_t key_len, const char *val, size_t val_len) {
char *dst;
size_t i;
@ -683,6 +686,7 @@ static int env_add(char_array *env, const char *key, size_t key_len, const char
return 0;
}
#endif /* HAVE_FORK */
#if !defined(HAVE_FORK)
static int scgi_spawn_connection(server *srv,

@ -14,6 +14,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

@ -837,7 +837,9 @@ static int server_main (server * const srv, int argc, char **argv) {
int test_config = 0;
int i_am_root = 0;
int o;
#ifdef HAVE_FORK
int num_childs = 0;
#endif
int fd;
size_t i;
time_t idle_limit = 0, last_active_ts = time(NULL);

@ -107,10 +107,13 @@ typedef struct stat_cache {
buffer *hash_key; /* temp-store for the hash-key */
} stat_cache;
#ifdef HAVE_FAM_H
static handler_t stat_cache_handle_fdevent(server *srv, void *_fce, int revent);
#endif
stat_cache *stat_cache_init(server *srv) {
stat_cache *sc = NULL;
UNUSED(srv);
sc = calloc(1, sizeof(*sc));
force_assert(NULL != sc);

Loading…
Cancel
Save