GPU (Linux): ignore . when enumerating directories

This commit is contained in:
李通洲
2024-04-29 20:28:50 +08:00
parent 6bd3d2c434
commit 6e15a44168
+6 -1
View File
@@ -46,7 +46,12 @@ static void pciDetectAmdSpecific(const FFGPUOptions* options, FFGPUResult* gpu,
ffStrbufAppendS(pciDir, "/hwmon/");
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(pciDir->chars);
struct dirent* entry = readdir(dirp);
struct dirent* entry;
while ((entry = readdir(dirp)) != NULL)
{
if (entry->d_name[0] == '.') continue;
break;
}
if (!entry) return;
ffStrbufAppendS(pciDir, entry->d_name);
ffStrbufAppendC(pciDir, '/');