From 14e14cddf60e9858d5f3de8f46adfc42bc880cfa Mon Sep 17 00:00:00 2001 From: Matt Spinler Date: Fri, 7 Sep 2018 15:04:16 -0500 Subject: Traverse full GetSubTree output It isn't safe to assume that the interface passed in to GetSubtree will be the first one in the output, so need to traverse the whole structure. Tested: phosphor-discover-system-state was failing with the C++ mapper, but works with this fix. Change-Id: Ibc29280f9d51d8067e764da1745d30378bf7068d Signed-off-by: Matt Spinler --- settings.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/settings.cpp b/settings.cpp index e0600dc..70bf04e 100644 --- a/settings.cpp +++ b/settings.cpp @@ -43,15 +43,20 @@ Objects::Objects(sdbusplus::bus::bus& bus) : bus(bus) for (const auto& iter : result) { const Path& path = iter.first; - const Interface& interface = iter.second.begin()->second[0]; - if (autoRebootIntf == interface) + for (const auto& serviceIter : iter.second) { - autoReboot = path; - } - else if (powerRestoreIntf == interface) - { - powerRestorePolicy = path; + for (const auto& interface : serviceIter.second) + { + if (autoRebootIntf == interface) + { + autoReboot = path; + } + else if (powerRestoreIntf == interface) + { + powerRestorePolicy = path; + } + } } } } -- cgit v1.2.1