Unverified Commit af3f9cc9 by Serge Hallyn Committed by GitHub

Merge pull request #2130 from tych0/sigterm-handling

Sigterm handling
parents 05f2fed7 186dfb16
......@@ -382,6 +382,17 @@ int main(int argc, char *argv[])
switch (was_interrupted) {
case 0:
/* Some applications send SIGHUP in order to get init to reload
* its configuration. We don't want to forward this onto the
* application itself, because it probably isn't expecting this
* signal since it was expecting init to do something with it.
*
* Instead, let's explicitly ignore it here. The actual
* terminal case is handled in the monitor's handler, which
* sends this task a SIGTERM in the case of a SIGHUP, which is
* what we want.
*/
case SIGHUP:
break;
case SIGPWR:
case SIGTERM:
......
......@@ -345,6 +345,12 @@ static int signal_handler(int fd, uint32_t events, void *data,
}
}
if (siginfo.ssi_signo == SIGHUP) {
kill(hdlr->pid, SIGTERM);
INFO("Killing %d since terminal hung up", hdlr->pid);
return hdlr->init_died ? LXC_MAINLOOP_CLOSE : 0;
}
/* More robustness, protect ourself from a SIGCHLD sent
* by a process different from the container init.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment