diff options
author | venaas <venaas> | 2008-04-15 09:22:35 +0000 |
---|---|---|
committer | venaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf> | 2008-04-15 09:22:35 +0000 |
commit | 324054ce0cd8d39c5727b521bf97218b1e3090e9 (patch) | |
tree | 0b495083396b1d98a1b83f412b83f083b3bdd1f3 /radsecproxy.c | |
parent | f9cb45453fb88c6c42246abfd08374c16b3e636d (diff) |
blocking SIGPIPE
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/branches/release-1.1@229 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'radsecproxy.c')
-rw-r--r-- | radsecproxy.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/radsecproxy.c b/radsecproxy.c index a2ceeb3..33b2dd0 100644 --- a/radsecproxy.c +++ b/radsecproxy.c @@ -29,6 +29,7 @@ * 1 + (2 + 2 * 3) + (2 * 30) + (2 * 30) = 129 threads */ +#include <signal.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> @@ -3051,8 +3052,29 @@ int daemon(int a, int b) { } #endif +void *sighandler(void *arg) { + sigset_t sigset; + int sig; + + for(;;) { + sigfillset(&sigset); + sigwait(&sigset, &sig); + switch (sig) { + case 0: + /* completely ignoring this */ + break; + case SIGPIPE: + debug(DBG_WARN, "sighandler: got SIGPIPE, TLS write error?"); + break; + default: + debug(DBG_WARN, "sighandler: ignoring signal %d", sig); + } + } +} + int main(int argc, char **argv) { - pthread_t udpserverth, udpaccserverth, udpclient4rdth, udpclient6rdth; + pthread_t sigth, udpserverth, udpaccserverth, udpclient4rdth, udpclient6rdth; + sigset_t sigset; struct list_node *entry; uint8_t foreground = 0, pretend = 0, loglevel = 0; char *configfile = NULL; @@ -3090,6 +3112,12 @@ int main(int argc, char **argv) { debug(DBG_INFO, "radsecproxy 1.1-prebeta starting"); + sigemptyset(&sigset); + /* exit on all but SIGPIPE, ignore more? */ + sigaddset(&sigset, SIGPIPE); + pthread_sigmask(SIG_BLOCK, &sigset, NULL); + pthread_create(&sigth, NULL, sighandler, NULL); + if (client_udp_count) { udp_server_replyq = newreplyq(); if (pthread_create(&udpserverth, NULL, udpserverrd, NULL)) |