mapper-wait: handle switch to openbmc exceptions
libmapper was searching for specific errno values (ENOENT) as
an indication of the mapper API failure instead of the error
message, which made it difficult to identify the need to fix up
the error path. Switch from checking for ENOENT to the
xyz.openbmc_project error message returned by the APIs.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I58700acd89f7f01474e2b985c8a8fec323cec112
diff --git a/libmapper/mapper.c b/libmapper/mapper.c
index 0f93937..4b69ac2 100644
--- a/libmapper/mapper.c
+++ b/libmapper/mapper.c
@@ -178,10 +178,12 @@
if (wait->finished)
goto exit;
- r = sd_bus_message_get_errno(m);
- if (r == ENOENT)
+ if (sd_bus_message_is_method_error(
+ m, "xyz.openbmc_project.Common.Error.ResourceNotFound"))
goto exit;
+ r = sd_bus_message_get_errno(m);
+
if ((r == EBUSY || r == ENOBUFS) && data->retry < mapper_busy_retries)
{
r = sd_event_now(wait->loop, CLOCK_MONOTONIC, &next_retry);
@@ -412,7 +414,8 @@
r = sd_bus_message_get_errno(m);
- if (r == ENOENT)
+ if (sd_bus_message_is_method_error(
+ m, "xyz.openbmc_project.Common.Error.ResourceNotFound"))
{
if (subtree->op == MAPPER_OP_REMOVE)
r = 0;