diff options
author | William Hubbs <w.d.hubbs@gmail.com> | 2017-10-24 10:26:18 -0500 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2017-10-24 10:26:18 -0500 |
commit | fdce4769f2e0f4175163ffa181c7b3b2192f7b22 (patch) | |
tree | 45de83ddd46d287a7fe96df171e8f3bd3797d7da /src/rc/rc-misc.c | |
parent | 35b1996704f6635bb29ea3604410e133209e6432 (diff) |
supervise-daemon: multiple fixes
- Harden against dying by handling all signals that would terminate the
program and adding --reexec support
- factor the supervisor into its own function
- fix test for whether we are already running
Diffstat (limited to 'src/rc/rc-misc.c')
-rw-r--r-- | src/rc/rc-misc.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c index d43f1274..33a17b35 100644 --- a/src/rc/rc-misc.c +++ b/src/rc/rc-misc.c @@ -218,6 +218,18 @@ signal_setup(int sig, void (*handler)(int)) } int +signal_setup_restart(int sig, void (*handler)(int)) +{ + struct sigaction sa; + + memset(&sa, 0, sizeof (sa)); + sigemptyset(&sa.sa_mask); + sa.sa_handler = handler; + sa.sa_flags = SA_RESTART; + return sigaction(sig, &sa, NULL); +} + +int svc_lock(const char *applet) { char file[PATH_MAX]; |