diff options
author | Andrei Vagin <avagin@google.com> | 2019-09-13 21:43:12 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-09-13 21:44:57 -0700 |
commit | 239a07aabfad8991556b43c85c30270d09353f86 (patch) | |
tree | 00b0eb04c8922adebbc7ecf21d8e6e1ba590a521 /pkg/sentry/syscalls/linux/sys_file.go | |
parent | 2bbf73d9ed85bbff81f1e56a6753dfe402682459 (diff) |
gvisor: return ENOTDIR from the unlink syscall
ENOTDIR has to be returned when a component used as a directory in
pathname is not, in fact, a directory.
PiperOrigin-RevId: 269037893
Diffstat (limited to 'pkg/sentry/syscalls/linux/sys_file.go')
-rw-r--r-- | pkg/sentry/syscalls/linux/sys_file.go | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_file.go b/pkg/sentry/syscalls/linux/sys_file.go index 2e00a91ce..b9a8e3e21 100644 --- a/pkg/sentry/syscalls/linux/sys_file.go +++ b/pkg/sentry/syscalls/linux/sys_file.go @@ -1423,9 +1423,6 @@ func unlinkAt(t *kernel.Task, dirFD int32, addr usermem.Addr) error { if err != nil { return err } - if dirPath { - return syserror.ENOENT - } return fileOpAt(t, dirFD, path, func(root *fs.Dirent, d *fs.Dirent, name string, _ uint) error { if !fs.IsDir(d.Inode.StableAttr) { @@ -1436,7 +1433,7 @@ func unlinkAt(t *kernel.Task, dirFD int32, addr usermem.Addr) error { return err } - return d.Remove(t, root, name) + return d.Remove(t, root, name, dirPath) }) } |