From 9606d987722ee5b89bbfae230389d3385a3884b0 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 14 May 2020 17:49:44 +0200 Subject: Replace standard signal handling in initd with signalfd + epoll Signed-off-by: David Oberhollenzer --- initd/runsvc.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'initd/runsvc.c') diff --git a/initd/runsvc.c b/initd/runsvc.c index 5495f15..682f4c6 100644 --- a/initd/runsvc.c +++ b/initd/runsvc.c @@ -195,18 +195,6 @@ pid_t runsvc(service_t *svc) perror("fork"); if (pid == 0) { - cli(NULL); - - memset(&act, 0, sizeof(act)); - act.sa_handler = runsvc_sighandler; - sigaction(SIGTERM, &act, NULL); - sigaction(SIGINT, &act, NULL); - sigaction(SIGHUP, &act, NULL); - - act.sa_handler = SIG_DFL; - sigaction(SIGUSR1, &act, NULL); - sigaction(SIGCHLD, &act, NULL); - if (setup_env()) exit(EXIT_FAILURE); @@ -218,6 +206,11 @@ pid_t runsvc(service_t *svc) exit(EXIT_FAILURE); } + memset(&act, 0, sizeof(act)); + act.sa_handler = runsvc_sighandler; + sigaction(SIGTERM, &act, NULL); + sigaction(SIGINT, &act, NULL); + sigaction(SIGHUP, &act, NULL); sti(NULL); if (svc->flags & SVC_FLAG_SUB_REAPER) { -- cgit v1.2.3