summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/socket/netstack/netstack_vfs2.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-01-22 20:40:39 +0000
committergVisor bot <gvisor-bot@google.com>2021-01-22 20:40:39 +0000
commit993bee6697b0e371d902f18b81787c14d12180f5 (patch)
tree0a35ed69a975448d874b765fbae6e229dd19621b /pkg/sentry/socket/netstack/netstack_vfs2.go
parent77dfca5954fab10c93faff1236d9e42d84defc22 (diff)
parent6c0e1d9cfe6adbfbb32e7020d6426608ac63ad37 (diff)
Merge release-20210112.0-74-g6c0e1d9cf (automated)
Diffstat (limited to 'pkg/sentry/socket/netstack/netstack_vfs2.go')
-rw-r--r--pkg/sentry/socket/netstack/netstack_vfs2.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/sentry/socket/netstack/netstack_vfs2.go b/pkg/sentry/socket/netstack/netstack_vfs2.go
index 9600a64e1..3bbdf552e 100644
--- a/pkg/sentry/socket/netstack/netstack_vfs2.go
+++ b/pkg/sentry/socket/netstack/netstack_vfs2.go
@@ -128,8 +128,8 @@ func (s *SocketVFS2) Write(ctx context.Context, src usermem.IOSequence, opts vfs
return 0, syserror.EOPNOTSUPP
}
- f := &ioSequencePayload{ctx: ctx, src: src}
- n, err := s.Endpoint.Write(f, tcpip.WriteOptions{})
+ r := src.Reader(ctx)
+ n, err := s.Endpoint.Write(r, tcpip.WriteOptions{})
if err == tcpip.ErrWouldBlock {
return 0, syserror.ErrWouldBlock
}
@@ -137,11 +137,11 @@ func (s *SocketVFS2) Write(ctx context.Context, src usermem.IOSequence, opts vfs
return 0, syserr.TranslateNetstackError(err).ToError()
}
- if int64(n) < src.NumBytes() {
- return int64(n), syserror.ErrWouldBlock
+ if n < src.NumBytes() {
+ return n, syserror.ErrWouldBlock
}
- return int64(n), nil
+ return n, nil
}
// Accept implements the linux syscall accept(2) for sockets backed by