summaryrefslogtreecommitdiff
path: root/redfish-core
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2024-04-07 23:47:06 +0300
committerEd Tanous <ed@tanous.net>2024-04-11 21:21:53 +0300
commit4c521c3c34162b6a5930ac1d78da3456f9b69283 (patch)
tree9341d14061a4dd9a21d41a528a66d45c78687b74 /redfish-core
parent8c3faccc941d5b32722554f8f24f320fd02dd4ab (diff)
downloadbmcweb-4c521c3c34162b6a5930ac1d78da3456f9b69283.tar.xz
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>
Diffstat (limited to 'redfish-core')
-rw-r--r--redfish-core/include/event_service_manager.hpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index 9872bf8410..0c12cd31ea 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -766,8 +766,17 @@ class EventServiceManager
}
persistent_data::getConfig().writeData();
- std::remove(eventServiceFile);
- BMCWEB_LOG_DEBUG("Remove old eventservice config");
+ std::error_code ec;
+ std::filesystem::remove(eventServiceFile, ec);
+ if (ec)
+ {
+ BMCWEB_LOG_DEBUG(
+ "Failed to remove old event service file. Ignoring");
+ }
+ else
+ {
+ BMCWEB_LOG_DEBUG("Remove old eventservice config");
+ }
}
}