From 0f84ea5afe21c9ebbccb9fa41482a8f7f8d9d3a1 Mon Sep 17 00:00:00 2001 From: Fabricio Voznika Date: Tue, 9 Feb 2021 14:10:59 -0800 Subject: Fix fd leak from test PiperOrigin-RevId: 356587965 --- test/syscalls/linux/open_create.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test') 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) { -- cgit v1.2.3