diff options
author | Ayush Ranjan <ayushranjan@google.com> | 2019-08-07 19:12:48 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-08-07 19:13:41 -0700 |
commit | 08cd5e1d368716f262ba9c31d94b1d7a29dbc5cf (patch) | |
tree | a8192b9caa87a836a13b491b4a5877e8185ee44f /pkg/sentry/fs/ext/directory.go | |
parent | 40d6d8c15b7deb8c1df1d8e764b014ca7140873e (diff) |
ext: Seek unit tests.
PiperOrigin-RevId: 262264674
Diffstat (limited to 'pkg/sentry/fs/ext/directory.go')
-rw-r--r-- | pkg/sentry/fs/ext/directory.go | 4 |
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 |