summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/ext/directory.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/fs/ext/directory.go')
-rw-r--r--pkg/sentry/fs/ext/directory.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/sentry/fs/ext/directory.go b/pkg/sentry/fs/ext/directory.go
index f896dbe1d..1ba8bf54c 100644
--- a/pkg/sentry/fs/ext/directory.go
+++ b/pkg/sentry/fs/ext/directory.go
@@ -217,7 +217,9 @@ func (fd *directoryFD) Seek(ctx context.Context, offset int64, whence int32) (in
defer dir.mu.Unlock()
// Find resulting offset.
- offset += fd.off
+ if whence == linux.SEEK_CUR {
+ offset += fd.off
+ }
if offset < 0 {
// lseek(2) specifies that EINVAL should be returned if the resulting offset