From ac8f0c2070d04fb2b4a53bc642129b026bf139a7 Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Wed, 13 Jan 2021 14:23:54 +0100 Subject: [PATCH] bluetooth/bluez5-util: Do not reply to ClearConfiguration Similar to the situation/comment in `endpoint_release` BlueZ does not request any reply to `ClearConfiguration()` either; sending one results in the same "0 matched rules" warning from dbus-daemon: dbus-daemon[1309]: [system] Rejected send message, 0 matched rules; type="method_return", sender=":1.71" (uid=1000 pid=87548 comm="../build/src/daemon/pulseaudio -vvvv -n -F ../buil") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.3" (uid=0 pid=1308 comm="/usr/lib/bluetooth/bluetoothd -d ") Solve this by only creating a return message when an (othwise empty) reply is solicited for, just like in `endpoint_release`. Unfortunately we also have to make sure to not send any error back if no reply is requested, but fortunately an argument parsing error here is extremely unlikely. Part-of: --- src/modules/bluetooth/bluez5-util.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c index 5017e4526..c5694aef7 100644 --- a/src/modules/bluetooth/bluez5-util.c +++ b/src/modules/bluetooth/bluez5-util.c @@ -1909,7 +1909,7 @@ fail: static DBusMessage *endpoint_clear_configuration(DBusConnection *conn, DBusMessage *m, void *userdata) { pa_bluetooth_discovery *y = userdata; pa_bluetooth_transport *t; - DBusMessage *r; + DBusMessage *r = NULL; DBusError err; const char *path; @@ -1926,12 +1926,14 @@ static DBusMessage *endpoint_clear_configuration(DBusConnection *conn, DBusMessa pa_bluetooth_transport_free(t); } - pa_assert_se(r = dbus_message_new_method_return(m)); + if (!dbus_message_get_no_reply(m)) + pa_assert_se(r = dbus_message_new_method_return(m)); return r; fail: - pa_assert_se(r = dbus_message_new_error(m, "org.bluez.Error.InvalidArguments", "Unable to clear configuration")); + if (!dbus_message_get_no_reply(m)) + pa_assert_se(r = dbus_message_new_error(m, "org.bluez.Error.InvalidArguments", "Unable to clear configuration")); return r; }