aboutsummaryrefslogtreecommitdiff
path: root/src/rc/rc-misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rc/rc-misc.c')
-rw-r--r--src/rc/rc-misc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c
index 1b79d2c8..50101b43 100644
--- a/src/rc/rc-misc.c
+++ b/src/rc/rc-misc.c
@@ -39,10 +39,12 @@
#include <sys/utsname.h>
#include <ctype.h>
#include <limits.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "einfo.h"
#include "rc.h"
#include "rc-misc.h"
#include "strlist.h"
@@ -429,3 +431,14 @@ bool service_plugable (const char *service)
free (list);
return (allow);
}
+
+void signal_setup (int sig, void (*handler)(int))
+{
+ struct sigaction sa;
+
+ memset (&sa, 0, sizeof (sa));
+ sa.sa_handler = handler;
+ sigemptyset (&sa.sa_mask);
+ if (sigaction (sig, &sa, NULL) == -1)
+ eerrorx ("sigaction: %s", strerror (errno));
+}