summaryrefslogtreecommitdiff
path: root/src/rc/rc-misc.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-02-01 13:20:19 +0000
committerRoy Marples <roy@marples.name>2008-02-01 13:20:19 +0000
commitf2ce40d90b92f6049745f6f06191bd43b6b931dd (patch)
treebc64ec292bbe407b420f6795ce1da7cc4e01c08a /src/rc/rc-misc.c
parent01e148d29d643af342a67bfa2f70928d6a6e0b75 (diff)
downloadopenrc-f2ce40d90b92f6049745f6f06191bd43b6b931dd.tar.gz
openrc-f2ce40d90b92f6049745f6f06191bd43b6b931dd.tar.bz2
openrc-f2ce40d90b92f6049745f6f06191bd43b6b931dd.tar.xz
Use sigaction over signal.
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 1b79d2c..50101b4 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));
+}