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/nbd_proxy.hpp b/include/nbd_proxy.hpp
index 838e7a1..9607ddf 100644
--- a/include/nbd_proxy.hpp
+++ b/include/nbd_proxy.hpp
@@ -63,8 +63,13 @@
boost::system::error_code ec;
peerSocket.close(ec);
- BMCWEB_LOG_DEBUG("std::remove({})", socketId);
- std::remove(socketId.c_str());
+ BMCWEB_LOG_DEBUG("std::filesystem::remove({})", socketId);
+ std::error_code ec2;
+ std::filesystem::remove(socketId.c_str(), ec2);
+ if (ec2)
+ {
+ BMCWEB_LOG_DEBUG("Failed to remove file, ignoring");
+ }
crow::connections::systemBus->async_method_call(
dbus::utility::logError, "xyz.openbmc_project.VirtualMedia", path,