summaryrefslogtreecommitdiffstats
path: root/mboxd_dbus.c
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2017-04-19 13:44:15 +0930
committerAndrew Jeffery <andrew@aj.id.au>2017-04-19 07:55:22 +0000
commitded91bc53dafdb86ac4f203cc9d3006573fc407f (patch)
treed098217817015ba623695facf1cd1f8b8eea8afb /mboxd_dbus.c
parent0aff80c0fc286b9ba386365c79088ccf156a7ab8 (diff)
downloadphosphor-mboxd-ded91bc53dafdb86ac4f203cc9d3006573fc407f.tar.gz
phosphor-mboxd-ded91bc53dafdb86ac4f203cc9d3006573fc407f.zip
mboxd_dbus: Handle errors in reply path
We were seeing some odd errors in the journal, for example: dbus[736]: [system] Rejected send message, 0 matched rules; type="error", sender=":1.14" (uid=0 pid=773 comm="/usr/sbin/mboxd --flash 64M --verbose --window-siz") interface="(unset)" member="(unset)" error name="org.freedesktop.DBus.Error.UnknownMethod" requested_reply="0" destination=":1.123" (uid=0 pid=2157 comm="/usr/sbin/mboxctl --reset ") However, coinciding with the deployment of the patched mboxd the errors went away. This patch shouldn't fix whatever was going on, but at least we might see some report of problems in the reply codepath if it occurs again in the future. Change-Id: I90dc4dd8e69e3fc998ab7f04cbeec37c20c92bcf Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Diffstat (limited to 'mboxd_dbus.c')
-rw-r--r--mboxd_dbus.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/mboxd_dbus.c b/mboxd_dbus.c
index 3b09bb1..a72e48b 100644
--- a/mboxd_dbus.c
+++ b/mboxd_dbus.c
@@ -314,12 +314,31 @@ out:
if (rc < 0) {
resp.cmd = -rc;
}
- sd_bus_message_new_method_return(m, &n); /* Generate response */
- sd_bus_message_append(n, "y", resp.cmd); /* Set return code */
- sd_bus_message_append_array(n, 'y', resp.args, resp.num_args);
- sd_bus_send(sd_bus_message_get_bus(m), n, NULL); /* Send response */
+ rc = sd_bus_message_new_method_return(m, &n); /* Generate response */
+ if (rc < 0) {
+ MSG_ERR("sd_bus_message_new_method_return failed: %d\n", rc);
+ goto cleanup;
+ }
+
+ rc = sd_bus_message_append(n, "y", resp.cmd); /* Set return code */
+ if (rc < 0) {
+ MSG_ERR("sd_bus_message_append failed: %d\n", rc);
+ goto cleanup;
+ }
+
+ rc = sd_bus_message_append_array(n, 'y', resp.args, resp.num_args);
+ if (rc < 0) {
+ MSG_ERR("sd_bus_message_append_array failed: %d\n", rc);
+ goto cleanup;
+ }
+
+ rc = sd_bus_send(NULL, n, NULL); /* Send response */
+ if (rc < 0)
+ MSG_ERR("sd_bus_send failed: %d\n", rc);
+
+cleanup:
free(resp.args);
- return 0;
+ return rc;
}
static const sd_bus_vtable mboxd_vtable[] = {
OpenPOWER on IntegriCloud