summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Nault <g.nault@alphalink.fr>2018-11-13 16:47:31 +0100
committerDmitry Kozlov <xeb@mail.ru>2018-11-16 10:42:32 +0300
commitb280ed38a22d31ff3e14f91ec36ee51904a50c5b (patch)
treea290f9e44e15add69dca718f9101ae4c8c353151
parent7aedbea681303a2b934ee14a0498e4de2a44b7fb (diff)
downloadaccel-ppp-b280ed38a22d31ff3e14f91ec36ee51904a50c5b.tar.gz
accel-ppp-b280ed38a22d31ff3e14f91ec36ee51904a50c5b.zip
Add --no-sigsegv option to accel-pppd
It's often useful to let a program crash on SIGSEGV and let an external daemon, like monit or systemd, restart it when needed. This allows to generate core dumps and do post-mortem analysis based on the collected traces. This patch add the new '--no-sigsegv' option to disable accel-ppp's SIGSEGV handler and use the system's core(5) mechanism instead. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
-rw-r--r--accel-pppd/main.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/accel-pppd/main.c b/accel-pppd/main.c
index 54a0db1f..5c05a8d8 100644
--- a/accel-pppd/main.c
+++ b/accel-pppd/main.c
@@ -243,6 +243,7 @@ int main(int _argc, char **_argv)
int pagesize = sysconf(_SC_PAGE_SIZE);
int internal = 0;
int no_sigint = 0;
+ int no_sigsegv = 0;
argc = _argc;
argv = _argv;
@@ -270,6 +271,8 @@ int main(int _argc, char **_argv)
mprotect(conf_dump, len, PROT_READ);
} else if (!strcmp(argv[i], "--internal"))
internal = 1;
+ else if (!strcmp(argv[i], "--no-sigsegv"))
+ no_sigsegv = 1;
else if (!strcmp(argv[i], "--no-sigint"))
no_sigint = 1;
}
@@ -334,9 +337,11 @@ int main(int _argc, char **_argv)
sa.sa_mask = set;
sigaction(SIGUSR1, &sa, NULL);
- sa.sa_handler = sigsegv;
- sa.sa_mask = set;
- sigaction(SIGSEGV, &sa, NULL);
+ if (!no_sigsegv) {
+ sa.sa_handler = sigsegv;
+ sa.sa_mask = set;
+ sigaction(SIGSEGV, &sa, NULL);
+ }
sigdelset(&set, SIGKILL);