nspawn: make sure to send SIGTERM/SIGHUP to the main nspawn process if stubinit receives SIGRTMIN+3 (#6167)
This code already existed in some form, however commented. Remove the comments, as this was most likely simply a forgotten commenting for debugging purposes. This also extends the logic a bit, by sending SIGHUP right after the SIGTERM, so that shells will also terminate, when PID 1 gets a SIGRTMIN+3. Fixes: #5711
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
9fe4a3d98e
commit
a462478539
@@ -188,7 +188,16 @@ int stub_pid1(sd_id128_t uuid) {
|
||||
else
|
||||
assert_not_reached("Got unexpected signal");
|
||||
|
||||
/* (void) kill_and_sigcont(pid, SIGTERM); */
|
||||
r = kill_and_sigcont(pid, SIGTERM);
|
||||
|
||||
/* Let's send a SIGHUP after the SIGTERM, as shells tend to ignore SIGTERM but do react to SIGHUP. We
|
||||
* do it strictly in this order, so that the SIGTERM is dispatched first, and SIGHUP second for those
|
||||
* processes which handle both. That's because services tend to bind configuration reload or something
|
||||
* else to SIGHUP. */
|
||||
|
||||
if (r != -ESRCH)
|
||||
(void) kill(pid, SIGHUP);
|
||||
|
||||
quit_usec = now(CLOCK_MONOTONIC) + DEFAULT_TIMEOUT_USEC;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user