diff options
author | Andrei Vagin <avagin@google.com> | 2020-01-07 23:52:59 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-01-07 23:54:14 -0800 |
commit | a53ac7307abfeb7172e67f48d0a7aaa4b5c3f31e (patch) | |
tree | ca5d790509a18bbdb9d76391478e5ac1d7f81239 /pkg/sentry/fs/file.go | |
parent | e77ad574233b779519a253c6f58197c339e9100a (diff) |
fs/splice: don't report a partialResult error if there is no data loss
PiperOrigin-RevId: 288642552
Diffstat (limited to 'pkg/sentry/fs/file.go')
-rw-r--r-- | pkg/sentry/fs/file.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/sentry/fs/file.go b/pkg/sentry/fs/file.go index c0a6e884b..a2f966cb6 100644 --- a/pkg/sentry/fs/file.go +++ b/pkg/sentry/fs/file.go @@ -555,6 +555,10 @@ type lockedWriter struct { // // This applies only to Write, not WriteAt. Offset int64 + + // Err contains the first error encountered while copying. This is + // useful to determine whether Writer or Reader failed during io.Copy. + Err error } // Write implements io.Writer.Write. @@ -590,5 +594,8 @@ func (w *lockedWriter) WriteAt(buf []byte, offset int64) (int, error) { break } } + if w.Err == nil { + w.Err = err + } return written, err } |