CPU (Linux): don't crash if /sys/devices/system/cpu/cpufreq/ doesn't exist

Ref: #750
This commit is contained in:
李通洲
2024-03-07 21:31:11 +08:00
parent 0a6140346e
commit 4a7e60ef57
+2
View File
@@ -107,6 +107,8 @@ static bool detectFrequency(FFCPUResult* cpu)
{
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateS("/sys/devices/system/cpu/cpufreq/");
FF_AUTO_CLOSE_DIR DIR* dir = opendir(path.chars);
if (!dir) return false;
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
uint32_t baseLen = path.length;
bool flag = false;