diff options
author | Andrei Vagin <avagin@google.com> | 2020-06-12 11:56:43 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-06-12 11:58:15 -0700 |
commit | 6ec9d60403fdf7a33072eaa023e62bfd56ed9f5c (patch) | |
tree | 7ee6a2d602ee63d8a34fe955719ca4ece7e0aa6a /test/syscalls/linux/fcntl.cc | |
parent | 61d6c059ac3434ddf0c206975a116a09d0838338 (diff) |
vfs2: implement fcntl(fd, F_SETFL, flags)
PiperOrigin-RevId: 316148074
Diffstat (limited to 'test/syscalls/linux/fcntl.cc')
-rw-r--r-- | test/syscalls/linux/fcntl.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/syscalls/linux/fcntl.cc b/test/syscalls/linux/fcntl.cc index c7cc5816e..35e8a4ff3 100644 --- a/test/syscalls/linux/fcntl.cc +++ b/test/syscalls/linux/fcntl.cc @@ -115,6 +115,15 @@ PosixErrorOr<Cleanup> SubprocessLock(std::string const& path, bool for_write, return std::move(cleanup); } +TEST(FcntlTest, SetCloExecBadFD) { + // Open an eventfd file descriptor with FD_CLOEXEC descriptor flag not set. + FileDescriptor f = ASSERT_NO_ERRNO_AND_VALUE(NewEventFD(0, 0)); + auto fd = f.get(); + f.reset(); + ASSERT_THAT(fcntl(fd, F_GETFD), SyscallFailsWithErrno(EBADF)); + ASSERT_THAT(fcntl(fd, F_SETFD, FD_CLOEXEC), SyscallFailsWithErrno(EBADF)); +} + TEST(FcntlTest, SetCloExec) { // Open an eventfd file descriptor with FD_CLOEXEC descriptor flag not set. FileDescriptor fd = ASSERT_NO_ERRNO_AND_VALUE(NewEventFD(0, 0)); |