From c2c0f9cb7e8320de06ef280c6184bb6aeda71627 Mon Sep 17 00:00:00 2001 From: Ian Lewis Date: Sun, 21 Oct 2018 19:41:44 -0700 Subject: Updated cleanup code to be more explicit about ignoring errors. Errors are shown as being ignored by assigning to the blank identifier. PiperOrigin-RevId: 218103819 Change-Id: I7cc7b9d8ac503a03de5504ebdeb99ed30a531cf2 --- runsc/cgroup/cgroup.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runsc/cgroup/cgroup.go') diff --git a/runsc/cgroup/cgroup.go b/runsc/cgroup/cgroup.go index d6058a8a2..0ceeb3f28 100644 --- a/runsc/cgroup/cgroup.go +++ b/runsc/cgroup/cgroup.go @@ -190,7 +190,9 @@ func (c *Cgroup) Install(res *specs.LinuxResources) error { // Mark that cgroup resources are owned by me. log.Debugf("Creating cgroup %q", c.Name) c.Own = true - clean := specutils.MakeCleanup(func() { c.Uninstall() }) + // The Cleanup object cleans up partially created cgroups when an error occurs. + // Errors occuring during cleanup itself are ignored. + clean := specutils.MakeCleanup(func() { _ = c.Uninstall() }) defer clean.Clean() for key, ctrl := range controllers { -- cgit v1.2.3