diff options
author | Fabricio Voznika <fvoznika@google.com> | 2021-02-09 14:10:59 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-02-09 14:12:53 -0800 |
commit | 0f84ea5afe21c9ebbccb9fa41482a8f7f8d9d3a1 (patch) | |
tree | 7008000c69dc88df3722c0fcd151edffb6b16b5a /test/syscalls/linux/open_create.cc | |
parent | 18e993eb4f2e6db829acfb5e8725f7d12f73ab67 (diff) |
Fix fd leak from test
PiperOrigin-RevId: 356587965
Diffstat (limited to 'test/syscalls/linux/open_create.cc')
-rw-r--r-- | test/syscalls/linux/open_create.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/syscalls/linux/open_create.cc b/test/syscalls/linux/open_create.cc index f8fbea79e..46f41de50 100644 --- a/test/syscalls/linux/open_create.cc +++ b/test/syscalls/linux/open_create.cc @@ -46,8 +46,10 @@ TEST(CreateTest, ExistingFile) { TEST(CreateTest, CreateAtFile) { auto dir = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateDir()); auto dirfd = ASSERT_NO_ERRNO_AND_VALUE(Open(dir.path(), O_DIRECTORY, 0666)); - EXPECT_THAT(openat(dirfd.get(), "CreateAtFile", O_RDWR | O_CREAT, 0666), + int fd; + EXPECT_THAT(fd = openat(dirfd.get(), "CreateAtFile", O_RDWR | O_CREAT, 0666), SyscallSucceeds()); + EXPECT_THAT(close(fd), SyscallSucceeds()); } TEST(CreateTest, HonorsUmask_NoRandomSave) { |