Speculative fix of Windows build breakage am: 0f3d962283
Original change: https://android-review.googlesource.com/c/platform/external/perfetto/+/1914629
Change-Id: I5463fd0cd4ef766795b08479d6b565818661f8c8
diff --git a/src/base/file_utils.cc b/src/base/file_utils.cc
index 8f998dd..91a5fc4 100644
--- a/src/base/file_utils.cc
+++ b/src/base/file_utils.cc
@@ -238,7 +238,9 @@
return base::ErrStatus("Directory path %s is too long", dir_path.c_str());
WIN32_FIND_DATAA ffd;
- base::ScopedResource<HANDLE, FindClose, nullptr, false,
+ // Wrap FindClose to: (1) make the return unix-style; (2) deal w/ stdcall.
+ static auto find_close = [](HANDLE h) { return FindClose(h) ? 0 : -1; };
+ base::ScopedResource<HANDLE, find_close, nullptr, false,
base::PlatformHandleChecker>
hFind(FindFirstFileA(glob_path.c_str(), &ffd));
if (!hFind) {