Merge commit 'remotes/fml/master'
authorAndre Noll <maan@systemlinux.org>
Tue, 11 Dec 2007 20:17:01 +0000 (21:17 +0100)
committerAndre Noll <maan@systemlinux.org>
Tue, 11 Dec 2007 20:17:01 +0000 (21:17 +0100)
Makefile.in
command.c
ortp_send.c
server.c

index c5d5027a09858b256660b18fb67bb26efe34d5c4..827d04f9f7415a698bb9e520dc7c06e6a416084d 100644 (file)
@@ -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@
index aed9e6a0a34ab94ea6fce7b5708ac0b6e228efd2..d35113a500f0a2b78ce853996db9413bafd0be4f 100644 (file)
--- 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);
index 0c6cccb902a7be84f0f4ce1d40c699c7ff544cda..a1661a7f8efc36e51c56b0676ec598607161b14e 100644 (file)
@@ -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;
index d48a0c91e391e7238c551602dacc56a0f378899b..17ff7cb408ae62e551b8e0ce754fe4a1e667c901 100644 (file)
--- 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)