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/sandbox/sandbox.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runsc/sandbox/sandbox.go') 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 { -- cgit v1.2.3