From e73d6db2e56ee2f6b681c9d14cd88dd3f4450031 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Tue, 15 Oct 2024 10:18:26 +0800 Subject: [PATCH] Battery (Linux): improve performance by specifying `O_PATH` --- src/detection/battery/battery_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detection/battery/battery_linux.c b/src/detection/battery/battery_linux.c index 922b18a75..940b9d719 100644 --- a/src/detection/battery/battery_linux.c +++ b/src/detection/battery/battery_linux.c @@ -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); }