The full code block is:
<------>/* Ignore and block
SIGINT, SIGQUIT, SIGHUP.
<------> * The SIG_IGN is not a case because it will be
inherited
<------> * while a fork(). It's necessary to ignore signals
because
<------> * the klish itself and ACTION script share the same
terminal.
<------> */
<------>sa.sa_flags = 0;
<------>sigemptyset(&sa.sa_mask);
<------>sa.sa_handler = sigignore; /* Empty signal handler
*/
<------>sigaction(SIGINT, &sa, &old_sigint);
<------>sigaction(SIGQUIT, &sa, &old_sigquit);
<------>sigaction(SIGHUP, &sa, &old_sighup);
<------>/* Block signals for children processes. The block
state is inherited. */
<------>if (!intr) {
<------><------>sigset_t sigs;
<------><------>sigemptyset(&sigs);
<------><------>sigaddset(&sigs, SIGINT);
<------><------>sigaddset(&sigs, SIGQUIT);
<------><------>sigaddset(&sigs, SIGHUP);
<------><------>sigprocmask(SIG_BLOCK, &sigs,
&old_sigs);
<------>}
The signals redefined by sigaction()
are inherited by fork() but not inherited by execve() (exclude
SIG_IGN values).
So the first part of code block is
about klish itself but not for executed processes.
The signal blocking is inhereted by
execve(). So the second part of code block is for the executed
processes. But note the condition (!intr). It says that commands
with <COMMAND interrupt="true" ...> will not be blocked. May
be you need an 'interrupt="true"' field.
If you already have interrupt="true"
then probably your problem is shell signal handling. Try the same
operations without klish.
08.04.2020 20:47, Rick Taft пишет: