Fix seg fault in health
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/49840 was recently
checked in that made some changes here, and had issues that weren't
caught on my system because of how my sensor setup is setup. This
commit changes to only make a single copy, then filter the copy inplace,
rather than make a copy, filter, then do the move.
Tested: Ran redfish service validator in a similar setup to Romulus, and
saw that it passed with the same failures as previously.
Unit tested:
curl --insecure -u root:0penBmc "https://192.168.7.2:443/redfish/v1/TaskService"
now succeeds
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I5b59b7074e0a7aad4e95c5ddb625ff24170f3981
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
index 9a4cd6c..02edfdc 100644
--- a/redfish-core/lib/health.hpp
+++ b/redfish-core/lib/health.hpp
@@ -209,8 +209,9 @@
{
return;
}
- dbus::utility::ManagedObjectType copy = resp;
- for (auto it = resp.begin(); it != resp.end();)
+ self->statuses = resp;
+ for (auto it = self->statuses.begin();
+ it != self->statuses.end();)
{
if (boost::ends_with(it->first.str, "critical") ||
boost::ends_with(it->first.str, "warning"))
@@ -218,9 +219,8 @@
it++;
continue;
}
- it = copy.erase(it);
+ it = self->statuses.erase(it);
}
- self->statuses = std::move(copy);
},
"xyz.openbmc_project.ObjectMapper", "/",
"org.freedesktop.DBus.ObjectManager", "GetManagedObjects");