mirror of
https://github.com/troglobit/finit.git
synced 2026-10-13 10:14:47 +00:00
Unblock signals for pre/post/ready/cleanup scripts
The service_fork() function blocks all signals for the new process, it is up to the callee to call sig_unblock() before calling exec(). Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -20,6 +20,8 @@ All relevant changes are documented in this file.
|
||||
the default `SIGTERM`
|
||||
- Fix pre/post/ready/cleanup script execution if service has an
|
||||
optional `env:file` (leading `-`)
|
||||
- Fix blocked signals for pre/post/ready/cleanup scripts preventing
|
||||
normal shutdown when a service/sysv is stopped in its setup state
|
||||
|
||||
|
||||
[4.10][] - 2025-03-03
|
||||
|
||||
@@ -2155,6 +2155,8 @@ static void service_pre_script(svc_t *svc)
|
||||
strlcpy(buf, svc->pre_script, sizeof(buf));
|
||||
|
||||
set_pre_post_envs(svc, "pre");
|
||||
sig_unblock();
|
||||
|
||||
execvp(_PATH_BSHELL, argv);
|
||||
_exit(EX_OSERR);
|
||||
}
|
||||
@@ -2192,6 +2194,7 @@ static void service_post_script(svc_t *svc)
|
||||
else
|
||||
strlcpy(buf, svc->post_script, sizeof(buf));
|
||||
set_pre_post_envs(svc, "post");
|
||||
sig_unblock();
|
||||
|
||||
if (WIFEXITED(svc->status)) {
|
||||
char val[4];
|
||||
@@ -2253,6 +2256,8 @@ void service_ready_script(svc_t *svc)
|
||||
strlcpy(buf, svc->ready_script, sizeof(buf));
|
||||
|
||||
set_pre_post_envs(svc, "ready");
|
||||
sig_unblock();
|
||||
|
||||
execvp(_PATH_BSHELL, argv);
|
||||
_exit(EX_OSERR);
|
||||
}
|
||||
@@ -2289,6 +2294,8 @@ static void service_cleanup_script(svc_t *svc)
|
||||
strlcpy(buf, svc->cleanup_script, sizeof(buf));
|
||||
|
||||
set_pre_post_envs(svc, "cleanup");
|
||||
sig_unblock();
|
||||
|
||||
execvp(_PATH_BSHELL, argv);
|
||||
_exit(EX_OSERR);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user