From 9769a8eaa4b384d1b7db9f06edf28a6331cd2b64 Mon Sep 17 00:00:00 2001 From: Nicolas Lacasse Date: Mon, 12 Aug 2019 17:40:11 -0700 Subject: Handle ENOSPC with a partial write. Similar to the EPIPE case, we can return the number of bytes written before ENOSPC was encountered. If the app tries to write more, we can return ENOSPC on the next write. PiperOrigin-RevId: 263041648 --- pkg/sentry/syscalls/linux/error.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pkg/sentry') diff --git a/pkg/sentry/syscalls/linux/error.go b/pkg/sentry/syscalls/linux/error.go index 264301bfa..1d9018c96 100644 --- a/pkg/sentry/syscalls/linux/error.go +++ b/pkg/sentry/syscalls/linux/error.go @@ -91,6 +91,10 @@ func handleIOError(t *kernel.Task, partialResult bool, err, intr error, op strin // TODO(gvisor.dev/issue/161): In some cases SIGPIPE should // also be sent to the application. return nil + case syserror.ENOSPC: + // Similar to EPIPE. Return what we wrote this time, and let + // ENOSPC be returned on the next call. + return nil case syserror.ECONNRESET: // For TCP sendfile connections, we may have a reset. But we // should just return n as the result. -- cgit v1.2.3