mirror of
https://github.com/containerd/containerd.git
synced 2026-08-12 22:16:27 +00:00
Merge pull request #11966 from zouyee/master
fix: preserve nsPath on mount failure to ensure cleanup
This commit is contained in:
@@ -76,12 +76,12 @@ func newNS(baseDir string, pid uint32) (nsPath string, err error) {
|
||||
}
|
||||
mountPointFd.Close()
|
||||
|
||||
defer func() {
|
||||
defer func(targetPath string) {
|
||||
// Ensure the mount point is cleaned up on errors
|
||||
if err != nil {
|
||||
os.RemoveAll(nsPath)
|
||||
os.RemoveAll(targetPath)
|
||||
}
|
||||
}()
|
||||
}(nsPath)
|
||||
|
||||
if pid != 0 {
|
||||
procNsPath := getNetNSPathFromPID(pid)
|
||||
|
||||
Reference in New Issue
Block a user