From b2992a0f8a38578399fdecbc448f3bb715b456b4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 7 Jun 2019 17:50:46 +0200 Subject: [PATCH] improve error handling --- spa/plugins/bluez5/bluez5-monitor.c | 8 ++++++-- src/modules/module-rtkit.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/spa/plugins/bluez5/bluez5-monitor.c b/spa/plugins/bluez5/bluez5-monitor.c index 67ee0f37b..4da662908 100644 --- a/spa/plugins/bluez5/bluez5-monitor.c +++ b/spa/plugins/bluez5/bluez5-monitor.c @@ -1708,6 +1708,10 @@ static DBusHandlerResult profile_new_connection(DBusConnection *conn, DBusMessag asprintf(&pathfd, "%s/fd%d", path, fd); t = transport_create(monitor, pathfd, sizeof(struct transport_data)); + if (t == NULL) { + spa_log_warn(monitor->log, "can't create transport: %m"); + return DBUS_HANDLER_RESULT_NEED_MEMORY; + } spa_bt_transport_set_implementation(t, &sco_transport_impl, t); t->device = d; @@ -1940,7 +1944,7 @@ static void interface_added(struct spa_bt_monitor *monitor, if (a == NULL) { a = adapter_create(monitor, object_path); if (a == NULL) { - spa_log_warn(monitor->log, "can't create adapter"); + spa_log_warn(monitor->log, "can't create adapter: %m"); return; } } @@ -1960,7 +1964,7 @@ static void interface_added(struct spa_bt_monitor *monitor, if (d == NULL) { d = device_create(monitor, object_path); if (d == NULL) { - spa_log_warn(monitor->log, "can't create device"); + spa_log_warn(monitor->log, "can't create device: %m"); return; } } diff --git a/src/modules/module-rtkit.c b/src/modules/module-rtkit.c index fd79a1ec6..1ba19f4c7 100644 --- a/src/modules/module-rtkit.c +++ b/src/modules/module-rtkit.c @@ -469,7 +469,7 @@ static void idle_func(struct spa_source *source) } if ((r = pw_rtkit_make_realtime(system_bus, 0, rtprio)) < 0) { - pw_log_debug("could not make thread realtime: %s", strerror(r)); + pw_log_debug("could not make thread realtime: %s", spa_strerror(r)); } else { pw_log_debug("thread made realtime"); }