summaryrefslogtreecommitdiffhomepage
path: root/runsc/sandbox
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/sandbox
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/sandbox')
-rw-r--r--runsc/sandbox/sandbox.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/runsc/sandbox/sandbox.go b/runsc/sandbox/sandbox.go
index 0fe85cfe1..df235c5e9 100644
--- a/runsc/sandbox/sandbox.go
+++ b/runsc/sandbox/sandbox.go
@@ -68,7 +68,9 @@ type Sandbox struct {
// sandbox.
func Create(id string, spec *specs.Spec, conf *boot.Config, bundleDir, consoleSocket, userLog string, ioFiles []*os.File) (*Sandbox, error) {
s := &Sandbox{ID: id}
- c := specutils.MakeCleanup(func() { s.destroy() })
+ // The Cleanup object cleans up partially created sandboxes when an error occurs.
+ // Any errors occuring during cleanup itself are ignored.
+ c := specutils.MakeCleanup(func() { _ = s.destroy() })
defer c.Clean()
if cg, ok := cgroup.New(spec); ok {