From: Andre Noll Date: Tue, 11 Dec 2007 20:17:01 +0000 (+0100) Subject: Merge commit 'remotes/fml/master' X-Git-Tag: v0.3.0~59 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=dbc0f1fba57b6de0f6bb4d7ac40167a1047ea3cd;hp=f9d356c65720f944550f36af6dd364d0f0869dde Merge commit 'remotes/fml/master' --- diff --git a/Makefile.in b/Makefile.in index c5d5027a..827d04f9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -26,13 +26,15 @@ DEBUG_CPPFLAGS += -Wredundant-decls # many warnings about trivial stuff # CPPFLAGS += -Wconversion -# uncomment this if your compiler supports it -# LDFLAGS += -Wl,--gc-sections - +ifeq ($(uname_S),Linux) + CPPFLAGS += -fdata-sections -ffunction-sections + LDFLAGS += -Wl,--gc-sections + CPPFLAGS += -Wstrict-prototypes + CPPFLAGS += -Wshadow +endif CPPFLAGS += -Os CPPFLAGS += -Wall CPPFLAGS += -Wuninitialized -CPPFLAGS += -Wstrict-prototypes CPPFLAGS += -Wchar-subscripts CPPFLAGS += -Wformat-security CPPFLAGS += -DBINDIR='"$(BINDIR)"' @@ -43,9 +45,7 @@ CPPFLAGS += -DCC_VERSION='"$(cc_version)"' CPPFLAGS += -Werror-implicit-function-declaration CPPFLAGS += -Wmissing-format-attribute CPPFLAGS += -Wunused-macros -CPPFLAGS += -Wshadow CPPFLAGS += -Wbad-function-cast -CPPFLAGS += -fdata-sections -ffunction-sections CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F) CPPFLAGS += @SSL_CPPFLAGS@ CPPFLAGS += @ncurses_cppflags@ diff --git a/command.c b/command.c index aed9e6a0..d35113a5 100644 --- a/command.c +++ b/command.c @@ -40,8 +40,16 @@ static unsigned char rc4_buf[2 * RC4_KEY_LEN]; extern struct misc_meta_data *mmd; extern struct sender senders[]; -static void dummy(__a_unused int s) -{} +static void dummy(int s) +{ + /* + * At least on Solaris, SIGUSR1 is one-shot, i.e. the signal action is + * restored to the default state once the signal handler has been + * called. + */ + if (s == SIGUSR1) + signal(SIGUSR1, dummy); +} static void mmd_dup(struct misc_meta_data *new_mmd) { @@ -696,7 +704,6 @@ int handle_connect(int fd, const char *peername) signal(SIGINT, SIG_DFL); signal(SIGTERM, SIG_DFL); signal(SIGHUP, SIG_DFL); - signal(SIGUSR1, SIG_IGN); /* we need a blocking fd here as recv() might return EAGAIN otherwise. */ ret = mark_fd_blocking(fd); diff --git a/ortp_send.c b/ortp_send.c index 0c6cccb9..a1661a7f 100644 --- a/ortp_send.c +++ b/ortp_send.c @@ -162,7 +162,7 @@ static void ortp_send(long unsigned current_chunk, long unsigned chunks_sent, { struct ortp_target *ot, *tmp; size_t sendbuf_len; - unsigned header_len = 0; + size_t header_len = 0; int packet_type = ORTP_DATA; char *sendbuf, *header_buf = NULL; struct timeval *chunk_tv; diff --git a/server.c b/server.c index d48a0c91..17ff7cb4 100644 --- a/server.c +++ b/server.c @@ -283,22 +283,26 @@ out: static void setup_signal_handling(void) { - int ret = 0; - - signal_pipe = para_signal_init(); + signal_pipe = para_signal_init(); /* always successful */ PARA_NOTICE_LOG("setting up signal handlers\n"); - ret += para_install_sighandler(SIGINT); - ret += para_install_sighandler(SIGTERM); - ret += para_install_sighandler(SIGHUP); - ret += para_install_sighandler(SIGCHLD); - ret += para_install_sighandler(SIGUSR1); - signal(SIGPIPE, SIG_IGN); - if (ret != 5) { - PARA_EMERG_LOG("%s", "could not install signal handlers\n"); - exit(EXIT_FAILURE); - } + if (para_install_sighandler(SIGINT) < 0) + goto err; + if (para_install_sighandler(SIGTERM) < 0) + goto err; + if (para_install_sighandler(SIGHUP) < 0) + goto err; + if (para_install_sighandler(SIGCHLD) < 0) + goto err; + if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) + goto err; + if (signal(SIGUSR1, SIG_IGN) == SIG_ERR) + goto err; add_close_on_fork_list(signal_pipe); + return; +err: + PARA_EMERG_LOG("could not install signal handlers\n"); + exit(EXIT_FAILURE); } static unsigned init_network(void)