[pulseaudio-discuss] [PATCH v2 3/9] bluetooth: Check return value of start_thread()

Mikel Astiz mikel.astiz.oss at gmail.com
Fri Oct 19 01:11:23 PDT 2012


From: Mikel Astiz <mikel.astiz at bmw-carit.de>

The function can return an error, so in that case the profile change
should fail.
---
 src/modules/bluetooth/module-bluetooth-device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 33d42fe..4b98108 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -2142,7 +2142,6 @@ static int start_thread(struct userdata *u) {
 
     if (!(u->thread = pa_thread_new("bluetooth", thread_func, u))) {
         pa_log_error("Failed to create IO thread");
-        stop_thread(u);
         return -1;
     }
 
@@ -2233,7 +2232,8 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
             goto off;
 
     if (u->sink || u->source)
-        start_thread(u);
+        if (start_thread(u) < 0)
+            goto off;
 
     return 0;
 
-- 
1.7.11.7



More information about the pulseaudio-discuss mailing list