summaryrefslogtreecommitdiffhomepage
path: root/runsc/cgroup
diff options
context:
space:
mode:
authorIan Lewis <ianlewis@google.com>2018-10-21 19:41:44 -0700
committerShentubot <shentubot@google.com>2018-10-21 19:42:32 -0700
commitc2c0f9cb7e8320de06ef280c6184bb6aeda71627 (patch)
treee5f1d803900f54355b20f99d74817d0e292eb02c /runsc/cgroup
parentd7c11c741752813e56b7d8726a575a520260c56a (diff)
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
Diffstat (limited to 'runsc/cgroup')
-rw-r--r--runsc/cgroup/cgroup.go4
1 files changed, 3 insertions, 1 deletions
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 {