runsv: robustify signal handling - SIGTERM to child between vfork and exec could mess things up
While at it, rename bb_signals_recursive_norestart() to bb_signals_norestart(): "recursive" was implying we are setting SA_NODEFER allowing signal handler to be entered recursively, but we do not do that. function old new delta bb_signals_norestart - 70 +70 startservice 380 394 +14 bb_signals_recursive_norestart 70 - -70 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 1/0 up/down: 84/-70) Total: 14 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@@ -1111,10 +1111,10 @@ int svlogd_main(int argc, char **argv)
|
||||
sigaddset(&blocked_sigset, SIGALRM);
|
||||
sigaddset(&blocked_sigset, SIGHUP);
|
||||
sigprocmask(SIG_BLOCK, &blocked_sigset, NULL);
|
||||
bb_signals_recursive_norestart(1 << SIGTERM, sig_term_handler);
|
||||
bb_signals_recursive_norestart(1 << SIGCHLD, sig_child_handler);
|
||||
bb_signals_recursive_norestart(1 << SIGALRM, sig_alarm_handler);
|
||||
bb_signals_recursive_norestart(1 << SIGHUP, sig_hangup_handler);
|
||||
bb_signals_norestart(1 << SIGTERM, sig_term_handler);
|
||||
bb_signals_norestart(1 << SIGCHLD, sig_child_handler);
|
||||
bb_signals_norestart(1 << SIGALRM, sig_alarm_handler);
|
||||
bb_signals_norestart(1 << SIGHUP, sig_hangup_handler);
|
||||
|
||||
/* Without timestamps, we don't have to print each line
|
||||
* separately, so we can look for _last_ newline, not first,
|
||||
|
||||
Reference in New Issue
Block a user