mirror of
https://github.com/microsoft/WSL.git
synced 2025-12-10 00:44:55 -06:00
Fix service crash when collecting a linux crash dump when maxCrashDumpCount is set to 0 (#13755)
* Fix service crash when collecting a linux crash dump when maxCrashDumpCount is set to 0 * Move the check inside the function
This commit is contained in:
parent
1b7e27ef6f
commit
c3d369df90
@ -594,6 +594,11 @@ std::wstring wsl::windows::common::wslutil::DownloadFile(std::wstring_view Url,
|
||||
|
||||
void wsl::windows::common::wslutil::EnforceFileLimit(LPCWSTR Path, size_t Limit, const std::function<bool(const std::filesystem::directory_entry&)>& pred)
|
||||
{
|
||||
if (Limit <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<std::filesystem::file_time_type, std::filesystem::path> files;
|
||||
for (auto const& e : std::filesystem::directory_iterator{Path})
|
||||
{
|
||||
@ -603,7 +608,7 @@ void wsl::windows::common::wslutil::EnforceFileLimit(LPCWSTR Path, size_t Limit,
|
||||
}
|
||||
}
|
||||
|
||||
if (Limit < 0 || files.size() < Limit)
|
||||
if (files.size() < Limit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user