From a6494f9df645b360b13b76fa2df32e38f0c6f8ac Mon Sep 17 00:00:00 2001 From: Ken Rockot Date: Fri, 14 May 2021 13:13:23 -0700 Subject: [PATCH] Fix ScopedFD usage in unit test Fixes a minor detail in the CrashReportDatabaseTest.CleanBrokenDatabase test wherein a ScopedFD is explicitly closed before being released. Despite being technically safe in this instance, an impending upstream Chromium change to track and enforce ScopedFD ownership will catch this as a potential bug and intentionally crash the test. Change-Id: Ie5c2c84d7501036d16f990bb6093fcd406fa598d Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2898048 Reviewed-by: Robert Sesek Commit-Queue: Ken Rockot --- client/crash_report_database_test.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client/crash_report_database_test.cc b/client/crash_report_database_test.cc index 6796de68..3c6a0577 100644 --- a/client/crash_report_database_test.cc +++ b/client/crash_report_database_test.cc @@ -828,8 +828,7 @@ TEST_F(CrashReportDatabaseTest, CleanBrokenDatabase) { ASSERT_TRUE(LoggingWriteFile( handle.get(), &expired_timestamp, sizeof(expired_timestamp))); - ASSERT_TRUE(LoggingCloseFile(handle.get())); - ignore_result(handle.release()); + ASSERT_TRUE(LoggingCloseFile(handle.release())); EXPECT_EQ(db()->CleanDatabase(0), 1);