summaryrefslogtreecommitdiffhomepage
path: root/runsc
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2021-05-20 17:11:15 -0700
committergVisor bot <gvisor-bot@google.com>2021-05-20 17:14:19 -0700
commitec542dbedf2f454b8c3e126a19b6910cd9425e92 (patch)
treecb6a5f6106825abfa98a364a0c78f9945b72ac9a /runsc
parentaf229f46a1496f39b012b4e2b244c32bb7d0667c (diff)
Suppress log message when there is no error
PiperOrigin-RevId: 374981100
Diffstat (limited to 'runsc')
-rw-r--r--runsc/sandbox/sandbox.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/runsc/sandbox/sandbox.go b/runsc/sandbox/sandbox.go
index 8d31e33b2..29e202b7d 100644
--- a/runsc/sandbox/sandbox.go
+++ b/runsc/sandbox/sandbox.go
@@ -131,8 +131,9 @@ func New(conf *config.Config, args *Args) (*Sandbox, error) {
// The Cleanup object cleans up partially created sandboxes when an error
// occurs. Any errors occurring during cleanup itself are ignored.
c := cleanup.Make(func() {
- err := s.destroy()
- log.Warningf("error destroying sandbox: %v", err)
+ if err := s.destroy(); err != nil {
+ log.Warningf("error destroying sandbox: %v", err)
+ }
})
defer c.Clean()