aboutsummaryrefslogtreecommitdiffstats
path: root/src/jalv.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/jalv.c')
-rw-r--r--src/jalv.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/jalv.c b/src/jalv.c
index b95e7d4..d25a8b2 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -878,8 +878,18 @@ main(int argc, char** argv)
zix_sem_init(&jalv.paused, 0);
zix_sem_init(&jalv.worker.sem, 0);
+#ifdef HAVE_SIGACTION
+ struct sigaction action;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = 0;
+ action.sa_handler = signal_handler;
+ sigaction(SIGINT, &action, NULL);
+ sigaction(SIGTERM, &action, NULL);
+#else
+ /* May not work in combination with fgets in the console interface */
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
+#endif
/* Find all installed plugins */
LilvWorld* world = lilv_world_new();