# 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)"'
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@
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)
{
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);
{
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;
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)