From d8c330254a7df21cb5edac3440b62a512fcc8d2d Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Thu, 28 Jan 2021 12:22:00 -0800 Subject: Add O_PATH support in vfs2 PiperOrigin-RevId: 354367665 --- test/syscalls/linux/read.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/syscalls/linux/read.cc') diff --git a/test/syscalls/linux/read.cc b/test/syscalls/linux/read.cc index 2633ba31b..98d5e432d 100644 --- a/test/syscalls/linux/read.cc +++ b/test/syscalls/linux/read.cc @@ -112,6 +112,15 @@ TEST_F(ReadTest, ReadDirectoryFails) { EXPECT_THAT(ReadFd(file.get(), buf.data(), 1), SyscallFailsWithErrno(EISDIR)); } +TEST_F(ReadTest, ReadWithOpath) { + SKIP_IF(IsRunningWithVFS1()); + const TempPath file = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateFile()); + const FileDescriptor fd = + ASSERT_NO_ERRNO_AND_VALUE(Open(file.path(), O_PATH)); + std::vector buf(1); + EXPECT_THAT(ReadFd(fd.get(), buf.data(), 1), SyscallFailsWithErrno(EBADF)); +} + } // namespace } // namespace testing -- cgit v1.2.3