diff options
author | Tamir Duberstein <tamird@google.com> | 2021-02-09 10:36:31 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-02-09 10:42:38 -0800 |
commit | 2b978d8743c5cf08d0e99512dd23580574a3ec23 (patch) | |
tree | a08e1bf80f9374ea3e20eb4a2c508e14520f1046 /pkg/sentry/fs/host/file.go | |
parent | fe4f4789601ddf61260271f7e1d33ba0f2756fcd (diff) |
Collapse code that always returns error
PiperOrigin-RevId: 356536548
Diffstat (limited to 'pkg/sentry/fs/host/file.go')
-rw-r--r-- | pkg/sentry/fs/host/file.go | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/pkg/sentry/fs/host/file.go b/pkg/sentry/fs/host/file.go index 86d1a87f0..fd4e057d8 100644 --- a/pkg/sentry/fs/host/file.go +++ b/pkg/sentry/fs/host/file.go @@ -180,16 +180,9 @@ func (f *fileOperations) Readdir(ctx context.Context, file *fs.File, serializer // IterateDir implements fs.DirIterator.IterateDir. func (f *fileOperations) IterateDir(ctx context.Context, d *fs.Dirent, dirCtx *fs.DirCtx, offset int) (int, error) { - if f.dirinfo == nil { - f.dirinfo = new(dirInfo) - f.dirinfo.buf = make([]byte, usermem.PageSize) - } - entries, err := f.iops.readdirAll(f.dirinfo) - if err != nil { - return offset, err - } - count, err := fs.GenericReaddir(dirCtx, fs.NewSortedDentryMap(entries)) - return offset + count, err + // We only support non-directory file descriptors that have been + // imported, so just claim that this isn't a directory, even if it is. + return offset, syscall.ENOTDIR } // Write implements fs.FileOperations.Write. |