]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
start: don't log stop/continue for non-init processes
authorTycho Andersen <tycho@tycho.ws>
Fri, 19 Jan 2018 00:50:39 +0000 (00:50 +0000)
committerTycho Andersen <tycho@tycho.ws>
Fri, 19 Jan 2018 03:18:02 +0000 (03:18 +0000)
This non-init forwarding check should really be before all the log messages
about "init continued" or "init stopped", since they will otherwise lie
about some process that wasn't init being stopped or continued.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
src/lxc/start.c

index 89a194fd1c45c83fc30ea312457e8a9f930e50c4..8b41442394f04a7f267550eea7946f80cf11544e 100644 (file)
@@ -323,6 +323,14 @@ static int signal_handler(int fd, uint32_t events, void *data,
        if (ret == 0 && info.si_pid == hdlr->pid)
                hdlr->init_died = true;
 
+       /* More robustness, protect ourself from a SIGCHLD sent
+        * by a process different from the container init.
+        */
+       if (siginfo.ssi_pid != hdlr->pid) {
+               NOTICE("Received %d from pid %d instead of container init %d.", siginfo.ssi_signo, siginfo.ssi_pid, hdlr->pid);
+               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);
@@ -337,14 +345,6 @@ static int signal_handler(int fd, uint32_t events, void *data,
                return hdlr->init_died ? LXC_MAINLOOP_CLOSE : 0;
        }
 
-       /* More robustness, protect ourself from a SIGCHLD sent
-        * by a process different from the container init.
-        */
-       if (siginfo.ssi_pid != hdlr->pid) {
-               NOTICE("Received SIGCHLD from pid %d instead of container init %d.", siginfo.ssi_pid, hdlr->pid);
-               return hdlr->init_died ? LXC_MAINLOOP_CLOSE : 0;
-       }
-
        DEBUG("Container init process %d exited.", hdlr->pid);
        return LXC_MAINLOOP_CLOSE;
 }