Battery (Linux): improve performance by specifying O_PATH

This commit is contained in:
Carter Li
2024-10-15 10:18:26 +08:00
parent 1c598add39
commit e73d6db2e5
+1 -1
View File
@@ -170,7 +170,7 @@ const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
if(entry->d_name[0] == '.')
continue;
FF_AUTO_CLOSE_FD int dfd = openat(dirfd(dirp), entry->d_name, O_RDONLY | O_CLOEXEC);
FF_AUTO_CLOSE_FD int dfd = openat(dirfd(dirp), entry->d_name, O_RDONLY | O_CLOEXEC | O_PATH | O_DIRECTORY);
if (dfd > 0) parseBattery(dfd, entry->d_name, options, results);
}