dbus: fix bus type reported in logs

This commit is contained in:
Stefano Ragni 2021-06-24 23:21:19 +02:00 committed by Wim Taymans
parent c69ebf6361
commit 243d534476
2 changed files with 11 additions and 2 deletions

View file

@ -296,6 +296,15 @@ static DBusHandlerResult filter_message (DBusConnection *connection,
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
static const char *type_to_string(enum spa_dbus_type type) {
switch (type) {
case SPA_DBUS_TYPE_SESSION: return "session";
case SPA_DBUS_TYPE_SYSTEM: return "system";
case SPA_DBUS_TYPE_STARTER: return "starter";
default: return "unknown";
}
}
static void *
impl_connection_get(struct spa_dbus_connection *conn)
{
@ -326,7 +335,7 @@ impl_connection_get(struct spa_dbus_connection *conn)
return this->conn;
error:
spa_log_error(impl->log, "Failed to connect to system bus: %s", error.message);
spa_log_error(impl->log, "Failed to connect to %s bus: %s", type_to_string(this->type), error.message);
dbus_error_free(&error);
errno = ECONNREFUSED;
return NULL;

View file

@ -301,6 +301,6 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
error:
free(impl);
pw_log_error("Failed to connect to system bus: %s", spa_strerror(res));
pw_log_error("Failed to connect to session bus: %s", spa_strerror(res));
return res;
}