Skip to content

Commit

Permalink
Merge pull request lxc#2258 from tych0/fix-signal-sending-to-lxc-init
Browse files Browse the repository at this point in the history
fix signal sending in lxc.init
  • Loading branch information
hallyn authored Apr 5, 2018
2 parents 22b2b9c + 9cb9438 commit 83ffaa1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/lxc/start.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,12 @@ static int signal_handler(int fd, uint32_t events, void *data,
return hdlr->init_died ? LXC_MAINLOOP_CLOSE : 0;
}

if (siginfo.ssi_signo != SIGCHLD) {
kill(hdlr->pid, siginfo.ssi_signo);
INFO("Forwarded signal %d to pid %d", siginfo.ssi_signo, 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.
*/
Expand All @@ -389,12 +395,6 @@ static int signal_handler(int fd, uint32_t events, void *data,
return hdlr->init_died ? LXC_MAINLOOP_CLOSE : 0;
}

if (siginfo.ssi_signo != SIGCHLD) {
kill(hdlr->pid, siginfo.ssi_signo);
INFO("Forwarded signal %d to pid %d", siginfo.ssi_signo, hdlr->pid);
return hdlr->init_died ? LXC_MAINLOOP_CLOSE : 0;
}

if (siginfo.ssi_code == CLD_STOPPED) {
INFO("Container init process was stopped");
return hdlr->init_died ? LXC_MAINLOOP_CLOSE : 0;
Expand Down

0 comments on commit 83ffaa1

Please sign in to comment.