Signed-off-by: Ferenc Wagner <wf...@niif.hu>
---
 src/lxc/start.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/lxc/start.c b/src/lxc/start.c
index ccd8bcd..8a3e4c4 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -192,13 +192,13 @@ static int setup_sigchld_fd(sigset_t *oldmask)
        sigset_t mask;
        int fd;
 
-       if (sigprocmask(SIG_BLOCK, NULL, &mask)) {
-               SYSERROR("failed to get mask signal");
-               return -1;
-       }
-
-       if (sigaddset(&mask, SIGCHLD) || sigprocmask(SIG_BLOCK, &mask, 
oldmask)) {
-               SYSERROR("failed to set mask signal");
+       /* Block everything except serious error signals */
+       if (sigfillset(&mask) ||
+           sigdelset(&mask, SIGILL) ||
+           sigdelset(&mask, SIGSEGV) ||
+           sigdelset(&mask, SIGBUS) ||
+           sigprocmask(SIG_BLOCK, &mask, oldmask)) {
+               SYSERROR("failed to set signal mask");
                return -1;
        }
 
@@ -228,7 +228,7 @@ static int sigchld_handler(int fd, void *data,
 
        ret = read(fd, &siginfo, sizeof(siginfo));
        if (ret < 0) {
-               ERROR("failed to read sigchld info");
+               ERROR("failed to read signal info");
                return -1;
        }
 
@@ -237,6 +237,12 @@ static int sigchld_handler(int fd, void *data,
                return -1;
        }
 
+       if (siginfo.ssi_signo != SIGCHLD) {
+               kill(*pid, siginfo.ssi_signo);
+               INFO("forwarded signal %d to pid %d", siginfo.ssi_signo, *pid);
+               return 0;
+       }
+
        if (siginfo.ssi_code == CLD_STOPPED ||
            siginfo.ssi_code == CLD_CONTINUED) {
                INFO("container init process was stopped/continued");
-- 
1.6.5


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to