summaryrefslogtreecommitdiff
path: root/redfish-core/include/event_service_manager.hpp
diff options
context:
space:
mode:
authorJiaqing Zhao <jiaqing.zhao@intel.com>2022-04-11 11:58:54 +0300
committerJiaqing Zhao <jiaqing.zhao@intel.com>2022-04-14 04:58:17 +0300
commit4f568f74b8bf1aa8dc50f0a2f6d12f2e11ed9383 (patch)
tree8864763e89b17b36c1b2cbdbf50e71cd40779707 /redfish-core/include/event_service_manager.hpp
parent725525eaac83bb355fb34aec5513a0a499fb471c (diff)
downloadbmcweb-4f568f74b8bf1aa8dc50f0a2f6d12f2e11ed9383.tar.xz
EventService: Enhance inotify event filename handling
In kernel inotify, the inotify_event.name is padded to a mutiple of sizeof(inotify_event) with '\0' and len is the size of char[] name, not the actual size of name. So constructing the name string with std::string(name, len) constructs a string with all the '\0's, which is not equal to the filename. This patch uses std::string(name) so that the string does not contain these '\0's. Tested: Manually create/delete /var/log/redfish, confirmed handler is entered by log. Change-Id: Ibaa96dd5c47b0205541a6ee155daa593b2e2114d Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
Diffstat (limited to 'redfish-core/include/event_service_manager.hpp')
-rw-r--r--redfish-core/include/event_service_manager.hpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index 759c798820..2c1ebfb768 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -1206,9 +1206,8 @@ class EventServiceManager
continue;
}
- std::string fileName(&readBuffer[index + iEventSize],
- event.len);
- if (std::strcmp(fileName.c_str(), "redfish") != 0)
+ std::string fileName(&readBuffer[index + iEventSize]);
+ if (fileName != "redfish")
{
index += (iEventSize + event.len);
continue;