Fix file removal
This code used std::remove, which is a mechanism for removing characters
from strings. Clearly it meant std::filesystem::remove(), which removes
files from the filesystem.
Correct it.
Change-Id: I030966203c1682a11c723c596accdf34637dd1ba
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/include/hostname_monitor.hpp b/include/hostname_monitor.hpp
index 6339a6b..188deff 100644
--- a/include/hostname_monitor.hpp
+++ b/include/hostname_monitor.hpp
@@ -28,7 +28,12 @@
BMCWEB_LOG_INFO("Replace HTTPs Certificate Success, "
"remove temporary certificate file..");
- remove(certPath.c_str());
+ std::error_code ec2;
+ std::filesystem::remove(certPath.c_str(), ec2);
+ if (ec2)
+ {
+ BMCWEB_LOG_ERROR("Failed to remove certificate");
+ }
},
"xyz.openbmc_project.Certs.Manager.Server.Https",
"/xyz/openbmc_project/certs/server/https/1",