linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gustavo F. Padovan" <padovan@profusion.mobi>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] audio/gateway.c: Don't reply to DBus when connection comes from AG
Date: Mon, 15 Feb 2010 17:34:21 -0200	[thread overview]
Message-ID: <1266262461-17717-1-git-send-email-padovan@profusion.mobi> (raw)

---
 audio/gateway.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/audio/gateway.c b/audio/gateway.c
index 46fbb63..22e5da2 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -224,7 +224,7 @@ static void rfcomm_connect_cb(GIOChannel *chan, GError *err,
 	struct audio_device *dev = user_data;
 	struct gateway *gw = dev->gateway;
 	DBusMessage *reply;
-	int sk;
+	int sk, ret;
 
 	if (err) {
 		error("connect(): %s", err->message);
@@ -242,11 +242,16 @@ static void rfcomm_connect_cb(GIOChannel *chan, GError *err,
 
 	gw->rfcomm = g_io_channel_ref(chan);
 
-	if (!agent_sendfd(gw->agent, sk, newconnection_reply, dev))
+	ret = agent_sendfd(gw->agent, sk, newconnection_reply, dev);
+
+	if (!gw->msg)
+		return;
+
+	if (ret)
+		reply = dbus_message_new_method_return(gw->msg);
+	else
 		reply = g_dbus_create_error(gw->msg, ERROR_INTERFACE ".Failed",
 					"Can not pass file descriptor");
-	else
-		reply = dbus_message_new_method_return(gw->msg);
 
 	g_dbus_send_message(dev->conn, reply);
 
@@ -258,7 +263,6 @@ fail:
 						ERROR_INTERFACE ".Failed",
 						"Connection attempt failed");
 
-
 	change_state(dev, GATEWAY_STATE_DISCONNECTED);
 }
 
-- 
1.6.4.4


             reply	other threads:[~2010-02-15 19:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-15 19:34 Gustavo F. Padovan [this message]
2010-02-16  5:27 ` [PATCH] audio/gateway.c: Don't reply to DBus when connection comes from AG Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1266262461-17717-1-git-send-email-padovan@profusion.mobi \
    --to=padovan@profusion.mobi \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).