summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cethcan/cethcan.h1
-rw-r--r--cethcan/main.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/cethcan/cethcan.h b/cethcan/cethcan.h
index 6763006..ab5edde 100644
--- a/cethcan/cethcan.h
+++ b/cethcan/cethcan.h
@@ -18,6 +18,7 @@
#include <sys/uio.h>
#include <fcntl.h>
#include <time.h>
+#include <signal.h>
#include <assert.h>
#include <event2/event.h>
diff --git a/cethcan/main.c b/cethcan/main.c
index a870ca2..961c543 100644
--- a/cethcan/main.c
+++ b/cethcan/main.c
@@ -8,6 +8,7 @@ int main(int argc, char **argv)
const char *cfgfile = "cethcan.json";
json_error_t je;
json_t *config;
+ struct sigaction sa;
do {
optch = getopt(argc, argv, "c:");
@@ -79,6 +80,13 @@ int main(int argc, char **argv)
json_decref(config);
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = SIG_IGN;
+ sigaction(SIGPIPE, &sa, NULL);
+ sigaction(SIGHUP, &sa, NULL);
+ sigaction(SIGUSR1, &sa, NULL);
+ sigaction(SIGUSR2, &sa, NULL);
+
event_base_loop(ev_base, 0);
return 0;
}