aboutsummaryrefslogtreecommitdiff
path: root/lib/xwrap.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xwrap.c')
-rw-r--r--lib/xwrap.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c
index 14703a72..44cd1684 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -638,3 +638,14 @@ char *xtzset(char *new)
return tz;
}
+
+// Set a signal handler
+void xsignal(int signal, void *handler)
+{
+ struct sigaction *sa = (void *)libbuf;
+
+ memset(sa, 0, sizeof(struct sigaction));
+ sa->sa_handler = handler;
+
+ if (sigaction(signal, sa, 0)) perror_exit("xsignal %d", signal);
+}