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>
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::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();