diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-06-22 00:33:35 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-06-22 00:33:35 +0000 |
commit | a590efb35cb6fcdf00a1cdfff4b712099302fe3b (patch) | |
tree | 35169ada982fb6639b755df0f57e25dca3211f68 /pkg/sentry/fs | |
parent | 83a296f99157d0fceb60b06f0b966b48576ddb06 (diff) | |
parent | ab6774cebf5c618d0cae579e84bd39666857f78b (diff) |
Merge ab6774ce (automated)
Diffstat (limited to 'pkg/sentry/fs')
-rw-r--r-- | pkg/sentry/fs/dirent.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pkg/sentry/fs/dirent.go b/pkg/sentry/fs/dirent.go index ca417d2bc..3cba259d9 100644 --- a/pkg/sentry/fs/dirent.go +++ b/pkg/sentry/fs/dirent.go @@ -948,9 +948,6 @@ func direntReaddir(ctx context.Context, d *Dirent, it DirIterator, root *Dirent, if dirCtx.Serializer == nil { panic("Dirent.Readdir: serializer must not be nil") } - if d.frozen { - return d.readdirFrozen(root, offset, dirCtx) - } // Check that this is actually a directory before emitting anything. // Once we have written entries for "." and "..", future errors from @@ -959,6 +956,16 @@ func direntReaddir(ctx context.Context, d *Dirent, it DirIterator, root *Dirent, return 0, syserror.ENOTDIR } + // This is a special case for lseek(fd, 0, SEEK_END). + // See SeekWithDirCursor for more details. + if offset == FileMaxOffset { + return offset, nil + } + + if d.frozen { + return d.readdirFrozen(root, offset, dirCtx) + } + // Collect attrs for "." and "..". dot, dotdot := d.GetDotAttrs(root) |