Skip to contentSkip to conversation

core: Fix not forwarding errors caused by SDP search properly

PATCH Applied Luiz Augusto von Dentz 2 participants 2 messages Oct 21, 2013 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 core: Fix not forwarding errors caused by SDP search properly

From: Luiz Augusto von Dentz <[email protected]>

In case bt_search_service fails while processing (e.g. connection is dropped) the error forward is a positive value leading btd_service_connecting_complete to not change any state at all.

Futhermore the error from sdp_process was completely ignored which may cause problems as well.

---
 src/sdp-client.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
src/sdp-client.c +4 -3
index 2789db6..1221f5e 100644
@@ -196,14 +196,15 @@ static gboolean search_process_cb(GIOChannel *chan, GIOCondition cond,
 							gpointer user_data)
 {
 	struct search_context *ctxt = user_data;
-	int err = 0;
+	int err;
 
 	if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
-		err = EIO;
+		err = -EIO;
 		goto failed;
 	}
 
-	if (sdp_process(ctxt->session) < 0)
+	err = sdp_process(ctxt->session);
+	if (err < 0)
 		goto failed;
 
 	return TRUE;
Signature · 1 line
1.8.3.1
#1 lore raw

Hi Luiz,

Quoted 9 lines · Luiz Augusto von Dentz

In case bt_search_service fails while processing (e.g. connection is dropped) the error forward is a positive value leading btd_service_connecting_complete to not change any state at all.

Futhermore the error from sdp_process was completely ignored which may cause problems as well.

---
 src/sdp-client.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Applied. Thanks.

Johan