diff options
author | Vernon Mauery <vernon.mauery@linux.intel.com> | 2019-03-06 14:03:00 -0800 |
---|---|---|
committer | Vernon Mauery <vernon.mauery@linux.intel.com> | 2019-03-29 19:01:23 +0000 |
commit | b0ab5fe80b7d5ce601550638bd836267dc878da9 (patch) | |
tree | ec20a75c27444b94310d492312129a55e0d97c60 /ipmid-new.cpp | |
parent | bdda8008226db9f4ae6d88b553ffa6192dfcfd57 (diff) | |
download | phosphor-host-ipmid-b0ab5fe80b7d5ce601550638bd836267dc878da9.tar.gz phosphor-host-ipmid-b0ab5fe80b7d5ce601550638bd836267dc878da9.zip |
resolve symbolic links to only load each library once
Historically, the provider libraries and symlinks to them were
installed in the /usr/lib/ipmid-providers directory. This can cause
ipmid to attempt to load each one twice. This change will make it
so ipmid will not load symlinks, but only real files.
Change-Id: I1353f01d509ef495bfa666eed97b034d73a1a90a
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
Diffstat (limited to 'ipmid-new.cpp')
-rw-r--r-- | ipmid-new.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ipmid-new.cpp b/ipmid-new.cpp index a6a5caa..5741842 100644 --- a/ipmid-new.cpp +++ b/ipmid-new.cpp @@ -415,7 +415,13 @@ std::forward_list<IpmiProvider> loadProviders(const fs::path& ipmiLibsPath) std::vector<fs::path> libs; for (const auto& libPath : fs::directory_iterator(ipmiLibsPath)) { + std::error_code ec; fs::path fname = libPath.path(); + if (fs::is_symlink(fname, ec) || ec) + { + // it's a symlink or some other error; skip it + continue; + } while (fname.has_extension()) { fs::path extn = fname.extension(); |