summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <etanous@nvidia.com>2024-03-16 02:16:21 +0300
committerEd Tanous <etanous@nvidia.com>2025-02-11 04:04:08 +0300
commitbb456a6d35c1e99b882dd286d689a6b711d9af87 (patch)
treeea7f107a81631099a2c4802ba8c1f0342d43606f
parent46f780f777ea8169f2c7d992aa2e979ed228b9b7 (diff)
downloadbmcweb-bb456a6d35c1e99b882dd286d689a6b711d9af87.tar.xz
Remove the last memcpy
This is the last memcpy in bmcweb. Remove it in leui of std::bit_cast Tested: Need help. Change-Id: Ibd6fbc1a8fa9e80cd7e7edf356f8a45448c16189 Signed-off-by: Ed Tanous <etanous@nvidia.com>
-rw-r--r--redfish-core/src/filesystem_log_watcher.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/redfish-core/src/filesystem_log_watcher.cpp b/redfish-core/src/filesystem_log_watcher.cpp
index af4a2415f4..41f2c6a488 100644
--- a/redfish-core/src/filesystem_log_watcher.cpp
+++ b/redfish-core/src/filesystem_log_watcher.cpp
@@ -13,6 +13,7 @@
#include <boost/asio/posix/stream_descriptor.hpp>
#include <array>
+#include <bit>
#include <cstddef>
#include <cstring>
#include <fstream>
@@ -125,8 +126,8 @@ void FilesystemLogWatcher::onINotify(const boost::system::error_code& ec,
std::size_t index = 0;
while ((index + iEventSize) <= bytesTransferred)
{
- struct inotify_event event{};
- std::memcpy(&event, &readBuffer[index], iEventSize);
+ struct inotify_event& event =
+ *std::bit_cast<struct inotify_event*>(&readBuffer[index]);
if (event.wd == dirWatchDesc)
{
if ((event.len == 0) ||