From 7741b1a960799b1724e92d23c6b2d9473ca71fee Mon Sep 17 00:00:00 2001
From: liuzekun <liuzekun@huawei.com>
Date: Thu, 31 Oct 2019 23:25:40 -0400
Subject: [PATCH] containerd: fix shouldKillAllOnExit check

reason: fix shouldKillAllOnExit check
v1 https://github.com/containerd/containerd/commit/fa5f744a790356472d4649b9ad1d955e36d0c7c0
v2 https://github.com/containerd/containerd/commit/872296642ac395acbc4344f529fcf4c6fddb5de2
Signed-off-by: Lifubang <lifubang@acmcoder.com>
---
 runtime/v1/shim/service.go | 2 +-
 runtime/v2/runc/service.go | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/runtime/v1/shim/service.go b/runtime/v1/shim/service.go
index ac545ea..88f7e0d 100644
--- a/runtime/v1/shim/service.go
+++ b/runtime/v1/shim/service.go
@@ -578,7 +578,7 @@ func shouldKillAllOnExit(bundlePath string) (bool, error) {
 
 	if bundleSpec.Linux != nil {
 		for _, ns := range bundleSpec.Linux.Namespaces {
-			if ns.Type == specs.PIDNamespace {
+			if ns.Type == specs.PIDNamespace && ns.Path == "" {
 				return false, nil
 			}
 		}
diff --git a/runtime/v2/runc/service.go b/runtime/v2/runc/service.go
index e37fb29..82beb8d 100644
--- a/runtime/v2/runc/service.go
+++ b/runtime/v2/runc/service.go
@@ -680,7 +680,7 @@ func shouldKillAllOnExit(bundlePath string) (bool, error) {
 
 	if bundleSpec.Linux != nil {
 		for _, ns := range bundleSpec.Linux.Namespaces {
-			if ns.Type == specs.PIDNamespace {
+			if ns.Type == specs.PIDNamespace && ns.Path == "" {
 				return false, nil
 			}
 		}
-- 
2.20.1

