]> git.proxmox.com Git - mirror_lxc.git/commitdiff
utils: fix handling of PID namespaces in lxc_set_death_signal
authorFelix Abecassis <fabecassis@nvidia.com>
Tue, 12 Mar 2019 00:13:48 +0000 (17:13 -0700)
committerFelix Abecassis <fabecassis@nvidia.com>
Tue, 12 Mar 2019 00:17:16 +0000 (17:17 -0700)
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
src/lxc/utils.c

index e2b2bb11e99f72228efa88b3c0e65abea315bf54..0262c7acd448a571b3423d15b4e277e29aad8d72 100644 (file)
@@ -1705,9 +1705,9 @@ int lxc_set_death_signal(int signal, pid_t parent)
        ret = prctl(PR_SET_PDEATHSIG, prctl_arg(signal), prctl_arg(0),
                    prctl_arg(0), prctl_arg(0));
 
-       /* Check whether we have been orphaned. */
+       /* If not in a PID namespace, check whether we have been orphaned. */
        ppid = (pid_t)syscall(SYS_getppid);
-       if (ppid != parent) {
+       if (ppid && ppid != parent) {
                ret = raise(SIGKILL);
                if (ret < 0)
                        return -1;