diff --git a/checkpoint.go b/checkpoint.go index a8a27f248bc..e6a58029883 100644 --- a/checkpoint.go +++ b/checkpoint.go @@ -70,7 +70,7 @@ checkpointed.`, err = container.Checkpoint(options) if err == nil && !(options.LeaveRunning || options.PreDump) { // Destroy the container unless we tell CRIU to keep it. - destroy(container) + _ = destroy(container) } return err }, diff --git a/delete.go b/delete.go index 682101ccad8..12c3ce3e767 100644 --- a/delete.go +++ b/delete.go @@ -18,7 +18,7 @@ func killContainer(container *libcontainer.Container) error { for i := 0; i < 100; i++ { time.Sleep(100 * time.Millisecond) if err := container.Signal(unix.Signal(0)); err != nil { - destroy(container) + _ = destroy(container) return nil } } @@ -72,7 +72,9 @@ status of "ubuntu01" as "stopped" the following will delete resources held for } switch s { case libcontainer.Stopped: - destroy(container) + if err := destroy(container); err != nil { + return err + } case libcontainer.Created: return killContainer(container) default: diff --git a/utils_linux.go b/utils_linux.go index b88e886ffa0..86b33bd2cf4 100644 --- a/utils_linux.go +++ b/utils_linux.go @@ -87,10 +87,12 @@ func newProcess(p specs.Process) (*libcontainer.Process, error) { return lp, nil } -func destroy(container *libcontainer.Container) { +func destroy(container *libcontainer.Container) error { if err := container.Destroy(); err != nil { logrus.Error(err) + return err } + return nil } // setupIO modifies the given process config according to the options. @@ -293,7 +295,7 @@ func (r *runner) run(config *specs.Process) (int, error) { func (r *runner) destroy() { if r.shouldDestroy { - destroy(r.container) + _ = destroy(r.container) } }