diff options
author | Zhaozhong Ni <nzz@google.com> | 2018-05-08 11:36:11 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-05-08 11:36:59 -0700 |
commit | 174161013de22be6a42b02ee06611a9de9e20b18 (patch) | |
tree | b910f76ea3ba8b14a29df2d28010fd0af1db18bb /pkg/sentry/fs/fdpipe | |
parent | 3ac3ea1d6afea0b128112e6a46b8bf47b4b0e02a (diff) |
Capture restore file system corruption errors in exit error.
PiperOrigin-RevId: 195850822
Change-Id: I4d7bdd8fe129c5ed461b73e1d7458be2cf5680c2
Diffstat (limited to 'pkg/sentry/fs/fdpipe')
-rw-r--r-- | pkg/sentry/fs/fdpipe/pipe_state.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pkg/sentry/fs/fdpipe/pipe_state.go b/pkg/sentry/fs/fdpipe/pipe_state.go index 8996a2178..99c40d8ed 100644 --- a/pkg/sentry/fs/fdpipe/pipe_state.go +++ b/pkg/sentry/fs/fdpipe/pipe_state.go @@ -63,7 +63,7 @@ func (p *pipeOperations) loadFlags(flags fs.FileFlags) { // afterLoad is invoked by stateify. func (p *pipeOperations) afterLoad() { - load := func() { + load := func() error { if !p.flags.Read { readPipeOperationsLoading.Wait() } else { @@ -75,14 +75,15 @@ func (p *pipeOperations) afterLoad() { Write: p.flags.Write, }) if err != nil { - panic(fmt.Sprintf("unable to open pipe %v: %v", p, err)) + return fmt.Errorf("unable to open pipe %v: %v", p, err) } if err := p.init(); err != nil { - panic(fmt.Sprintf("unable to initialize pipe %v: %v", p, err)) + return fmt.Errorf("unable to initialize pipe %v: %v", p, err) } + return nil } // Do background opening of pipe ends. Note for write-only pipe ends we // have to do it asynchronously to avoid blocking the restore. - fs.Async(load) + fs.Async(fs.CatchError(load)) } |