From b0ab5fe80b7d5ce601550638bd836267dc878da9 Mon Sep 17 00:00:00 2001 From: Vernon Mauery Date: Wed, 6 Mar 2019 14:03:00 -0800 Subject: 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 --- ipmid-new.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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 loadProviders(const fs::path& ipmiLibsPath) std::vector 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(); -- cgit v1.2.1