Skip to content

Commit de51009

Browse files
committed
hwmon: fix fs:path vs string punning
1 parent 70e7d05 commit de51009

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/hwmon.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ int HwmonInterface<FanDriver>::filter_driver_file(const struct dirent *entry)
7171

7272

7373
template<int (* filter_fn)(const struct dirent *)>
74-
vector<filesystem::path> dir_entries(const filesystem::path &dir)
74+
vector<string> dir_entries(const filesystem::path &dir)
7575
{
7676
struct dirent **entries;
7777
int nentries = ::scandir(dir.c_str(), &entries, filter_fn, nullptr);
7878
if (nentries == -1)
7979
return {};
8080

81-
vector<filesystem::path> rv;
81+
vector<string> rv;
8282
for (int i = 0; i < nentries; ++i) {
8383
rv.emplace_back(dir / entries[i]->d_name);
8484
::free(entries[i]);
@@ -212,12 +212,12 @@ vector<string> HwmonInterface<HwmonT>::find_hwmons_by_indices(
212212
}
213213
catch (IOerror &) {
214214
if (depth <= max_depth) {
215-
vector<filesystem::path> hwmon_dirs = dir_entries<filter_hwmon_dirs>(path);
215+
vector<string> hwmon_dirs = dir_entries<filter_hwmon_dirs>(path);
216216
if (hwmon_dirs.empty())
217217
throw IOerror("Error scanning " + path + ": ", errno);
218218

219219
vector<string> rv;
220-
for (const filesystem::path &hwmon_dir : hwmon_dirs) {
220+
for (const filesystem::path hwmon_dir : hwmon_dirs) {
221221
rv = HwmonInterface<HwmonT>::find_hwmons_by_indices(
222222
hwmon_dir,
223223
indices,
@@ -280,7 +280,7 @@ string HwmonInterface<HwmonT>::lookup()
280280
throw DriverInitError(path + ": " + "Could not find any hwmons in " + path);
281281
}
282282
else {
283-
vector<filesystem::path> paths = dir_entries<filter_driver_file>(path);
283+
vector<string> paths = dir_entries<filter_driver_file>(path);
284284
found_paths_.swap(paths);
285285
}
286286

0 commit comments

Comments
 (0)