This trips up when compiling with -Wvla otherwise.

PiperOrigin-RevId: 529762901
Change-Id: I6ce4d630191bf265f847aef2d5dcc12a712faa60
This commit is contained in:
Abseil Team 2023-05-05 11:04:05 -07:00 committed by Copybara-Service
parent a3580180d1
commit bc860af087

View File

@ -199,8 +199,8 @@ size_t GetThreadCount() {
mib[5] = static_cast<int>(size / static_cast<size_t>(mib[4]));
// populate array of structs
struct kinfo_proc info[mib[5]];
if (sysctl(mib, miblen, &info, &size, NULL, 0)) {
std::vector<struct kinfo_proc> info(mib[5]);
if (sysctl(mib, miblen, info.data(), &size, NULL, 0)) {
return 0;
}