From b54dbdfdc6b6cbdb6f45cd2abd9efb1f2f821a20 Mon Sep 17 00:00:00 2001 From: Dean Deng Date: Tue, 22 Sep 2020 22:29:28 -0700 Subject: Handle EOF properly in splice/sendfile. Use HandleIOErrorVFS2 instead of custom error handling. PiperOrigin-RevId: 333227581 --- pkg/sentry/kernel/pipe/pipe.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pkg/sentry/kernel/pipe/pipe.go') diff --git a/pkg/sentry/kernel/pipe/pipe.go b/pkg/sentry/kernel/pipe/pipe.go index c410c96aa..67beb0ad6 100644 --- a/pkg/sentry/kernel/pipe/pipe.go +++ b/pkg/sentry/kernel/pipe/pipe.go @@ -17,6 +17,7 @@ package pipe import ( "fmt" + "io" "sync/atomic" "syscall" @@ -215,7 +216,7 @@ func (p *Pipe) readLocked(ctx context.Context, ops readOps) (int64, error) { if p.view.Size() == 0 { if !p.HasWriters() { // There are no writers, return EOF. - return 0, nil + return 0, io.EOF } return 0, syserror.ErrWouldBlock } -- cgit v1.2.3