summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/syscalls/linux
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-11-08 20:24:38 +0000
committergVisor bot <gvisor-bot@google.com>2019-11-08 20:24:38 +0000
commit759da51175672e0de03657f95ba42c4c27ab3f26 (patch)
tree09e3f4a8b594ae7cee7a6c1d6bb75faa7a0af3d2 /pkg/sentry/syscalls/linux
parent6e114e15c6429c085a288de360ea073d6e4b99f0 (diff)
parentaf58a4e3bb0ba81c103429317eb0c2735450136c (diff)
Merge release-20190806.1-383-gaf58a4e (automated)
Diffstat (limited to 'pkg/sentry/syscalls/linux')
-rw-r--r--pkg/sentry/syscalls/linux/sys_file.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_file.go b/pkg/sentry/syscalls/linux/sys_file.go
index c9f57fe27..b9a8e3e21 100644
--- a/pkg/sentry/syscalls/linux/sys_file.go
+++ b/pkg/sentry/syscalls/linux/sys_file.go
@@ -169,7 +169,7 @@ func openAt(t *kernel.Task, dirFD int32, addr usermem.Addr, flags uint) (fd uint
if dirPath {
return syserror.ENOTDIR
}
- if flags&linux.O_TRUNC != 0 && fs.IsRegular(d.Inode.StableAttr) {
+ if flags&linux.O_TRUNC != 0 {
if err := d.Inode.Truncate(t, d, 0); err != nil {
return err
}
@@ -397,7 +397,7 @@ func createAt(t *kernel.Task, dirFD int32, addr usermem.Addr, flags uint, mode l
}
// Should we truncate the file?
- if flags&linux.O_TRUNC != 0 && fs.IsRegular(found.Inode.StableAttr) {
+ if flags&linux.O_TRUNC != 0 {
if err := found.Inode.Truncate(t, found, 0); err != nil {
return err
}
@@ -1483,7 +1483,7 @@ func Truncate(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sysc
if fs.IsDir(d.Inode.StableAttr) {
return syserror.EISDIR
}
- if !fs.IsRegular(d.Inode.StableAttr) {
+ if !fs.IsFile(d.Inode.StableAttr) {
return syserror.EINVAL
}
@@ -1523,7 +1523,7 @@ func Ftruncate(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sys
// Note that this is different from truncate(2) above, where a
// directory returns EISDIR.
- if !fs.IsRegular(file.Dirent.Inode.StableAttr) {
+ if !fs.IsFile(file.Dirent.Inode.StableAttr) {
return 0, nil, syserror.EINVAL
}