summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/host/control.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/fs/host/control.go')
-rw-r--r--pkg/sentry/fs/host/control.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/sentry/fs/host/control.go b/pkg/sentry/fs/host/control.go
index 480f0c8f4..9ebb9bbb3 100644
--- a/pkg/sentry/fs/host/control.go
+++ b/pkg/sentry/fs/host/control.go
@@ -32,17 +32,20 @@ func newSCMRights(fds []int) control.SCMRights {
}
// Files implements control.SCMRights.Files.
-func (c *scmRights) Files(ctx context.Context, max int) control.RightsFiles {
+func (c *scmRights) Files(ctx context.Context, max int) (control.RightsFiles, bool) {
n := max
+ var trunc bool
if l := len(c.fds); n > l {
n = l
+ } else if n < l {
+ trunc = true
}
rf := control.RightsFiles(fdsToFiles(ctx, c.fds[:n]))
// Only consume converted FDs (fdsToFiles may convert fewer than n FDs).
c.fds = c.fds[len(rf):]
- return rf
+ return rf, trunc
}
// Clone implements transport.RightsControlMessage.Clone.