diff options
Diffstat (limited to 'pkg/sentry')
-rw-r--r-- | pkg/sentry/control/state.go | 2 | ||||
-rw-r--r-- | pkg/sentry/kernel/kernel.go | 23 |
2 files changed, 13 insertions, 12 deletions
diff --git a/pkg/sentry/control/state.go b/pkg/sentry/control/state.go index 0a480c84a..b6bbf69fa 100644 --- a/pkg/sentry/control/state.go +++ b/pkg/sentry/control/state.go @@ -64,7 +64,7 @@ func (s *State) Save(o *SaveOpts, _ *struct{}) error { log.Infof("Save succeeded: exiting...") } else { log.Warningf("Save failed: exiting...") - s.Kernel.SetExitError(err) + s.Kernel.SetSaveError(err) } s.Kernel.Kill(kernel.ExitStatus{}) }, diff --git a/pkg/sentry/kernel/kernel.go b/pkg/sentry/kernel/kernel.go index 290c4a53c..ee6334509 100644 --- a/pkg/sentry/kernel/kernel.go +++ b/pkg/sentry/kernel/kernel.go @@ -175,9 +175,9 @@ type Kernel struct { // netlinkPorts manages allocation of netlink socket port IDs. netlinkPorts *port.Manager - // exitErr is the error causing the sandbox to exit, if any. It is - // protected by extMu. - exitErr error `state:"nosave"` + // saveErr is the error causing the sandbox to exit during save, if + // any. It is protected by extMu. + saveErr error `state:"nosave"` // danglingEndpoints is used to save / restore tcpip.DanglingEndpoints. danglingEndpoints struct{} `state:".([]tcpip.Endpoint)"` @@ -1029,20 +1029,21 @@ func (k *Kernel) NetlinkPorts() *port.Manager { return k.netlinkPorts } -// ExitError returns the sandbox error that caused the kernel to exit. -func (k *Kernel) ExitError() error { +// SaveError returns the sandbox error that caused the kernel to exit during +// save. +func (k *Kernel) SaveError() error { k.extMu.Lock() defer k.extMu.Unlock() - return k.exitErr + return k.saveErr } -// SetExitError sets the sandbox error that caused the kernel to exit, if one is -// not already set. -func (k *Kernel) SetExitError(err error) { +// SetSaveError sets the sandbox error that caused the kernel to exit during +// save, if one is not already set. +func (k *Kernel) SetSaveError(err error) { k.extMu.Lock() defer k.extMu.Unlock() - if k.exitErr == nil { - k.exitErr = err + if k.saveErr == nil { + k.saveErr = err } } |