From 12379a9a3c74f671e94a39f426b762fb78ddec19 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 12 Oct 2021 08:31:57 +1000 Subject: [PATCH] pipewire: fix error message if the DBus library load failed If the handle is NULL, we'd print out the strerror with res at whatever value it currently has, leading to confusion. --- src/pipewire/context.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pipewire/context.c b/src/pipewire/context.c index 68db76b5f..1530f13a9 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -459,10 +459,11 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop, SPA_NAME_SUPPORT_DBUS, NULL, n_support, this->support); - if (impl->dbus_handle == NULL || - (res = spa_handle_get_interface(impl->dbus_handle, - SPA_TYPE_INTERFACE_DBus, &dbus_iface)) < 0) { - pw_log_warn("%p: can't load dbus interface: %s", this, spa_strerror(res)); + if (impl->dbus_handle == NULL) { + pw_log_warn("%p: can't load dbus library: %s", this, lib); + } else if ((res = spa_handle_get_interface(impl->dbus_handle, + SPA_TYPE_INTERFACE_DBus, &dbus_iface)) < 0) { + pw_log_warn("%p: can't load dbus interface: %s", this, spa_strerror(res)); } else { this->support[n_support++] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_DBus, dbus_iface); }