summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVernon Mauery <vernon.mauery@linux.intel.com>2019-03-06 14:03:00 -0800
committerVernon Mauery <vernon.mauery@linux.intel.com>2019-03-29 19:01:23 +0000
commitb0ab5fe80b7d5ce601550638bd836267dc878da9 (patch)
treeec20a75c27444b94310d492312129a55e0d97c60
parentbdda8008226db9f4ae6d88b553ffa6192dfcfd57 (diff)
downloadphosphor-host-ipmid-b0ab5fe80b7d5ce601550638bd836267dc878da9.zip
phosphor-host-ipmid-b0ab5fe80b7d5ce601550638bd836267dc878da9.tar.gz
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>
-rw-r--r--ipmid-new.cpp6
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();
OpenPOWER on IntegriCloud