diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-11-20 23:12:35 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-11-20 23:12:35 +0000 |
commit | bd17bba359ecf2749e18c98b354a2633d35f88ac (patch) | |
tree | 6fa4eb4e27ff058123d24decbd1f0ccac8d126b1 /pkg/p9/handlers.go | |
parent | a98f44c8726eeec97e8b1e43978dd40d04d0b705 (diff) | |
parent | 012102eefd2b145ddee774cba28e4fa889fadd49 (diff) |
Merge release-20191114.0-16-g012102e (automated)
Diffstat (limited to 'pkg/p9/handlers.go')
-rw-r--r-- | pkg/p9/handlers.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/pkg/p9/handlers.go b/pkg/p9/handlers.go index ba9a55d6d..51869c7d6 100644 --- a/pkg/p9/handlers.go +++ b/pkg/p9/handlers.go @@ -272,15 +272,15 @@ func (t *Tlopen) handle(cs *connState) message { return newErr(syscall.EINVAL) } - // Are flags valid? - flags := t.Flags &^ OpenFlagsIgnoreMask - if flags&^OpenFlagsModeMask != 0 { - return newErr(syscall.EINVAL) - } - - // Is this an attempt to open a directory as writable? Don't accept. - if ref.mode.IsDir() && flags != ReadOnly { - return newErr(syscall.EINVAL) + if ref.mode.IsDir() { + // Directory must be opened ReadOnly. + if t.Flags&OpenFlagsModeMask != ReadOnly { + return newErr(syscall.EISDIR) + } + // Directory not truncatable. + if t.Flags&OpenTruncate != 0 { + return newErr(syscall.EISDIR) + } } var ( |