linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] btio: Fix the return value of bt_io functions
@ 2011-07-05 17:00 Vinicius Costa Gomes
  2011-07-09 16:23 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Vinicius Costa Gomes @ 2011-07-05 17:00 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Vinicius Costa Gomes

Some bt_io methods were ignoring the value stored in errno when
reporting the error to the caller.
---
 btio/btio.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/btio/btio.c b/btio/btio.c
index e84f6d0..2cc9082 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -271,8 +271,9 @@ static int l2cap_bind(int sock, const bdaddr_t *src, uint16_t psm,
 		addr.l2_psm = htobs(psm);
 
 	if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+		int error = -errno;
 		ERROR_FAILED(err, "l2cap_bind", errno);
-		return -1;
+		return error;
 	}
 
 	return 0;
@@ -294,7 +295,7 @@ static int l2cap_connect(int sock, const bdaddr_t *dst,
 
 	err = connect(sock, (struct sockaddr *) &addr, sizeof(addr));
 	if (err < 0 && !(errno == EAGAIN || errno == EINPROGRESS))
-		return err;
+		return -errno;
 
 	return 0;
 }
@@ -558,8 +559,9 @@ static int rfcomm_bind(int sock,
 	addr.rc_channel = channel;
 
 	if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+		int error = -errno;
 		ERROR_FAILED(err, "rfcomm_bind", errno);
-		return -1;
+		return error;
 	}
 
 	return 0;
@@ -577,7 +579,7 @@ static int rfcomm_connect(int sock, const bdaddr_t *dst, uint8_t channel)
 
 	err = connect(sock, (struct sockaddr *) &addr, sizeof(addr));
 	if (err < 0 && !(errno == EAGAIN || errno == EINPROGRESS))
-		return err;
+		return -errno;
 
 	return 0;
 }
@@ -604,8 +606,9 @@ static int sco_bind(int sock, const bdaddr_t *src, GError **err)
 	bacpy(&addr.sco_bdaddr, src);
 
 	if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+		int error = -errno;
 		ERROR_FAILED(err, "sco_bind", errno);
-		return -1;
+		return error;
 	}
 
 	return 0;
@@ -622,7 +625,7 @@ static int sco_connect(int sock, const bdaddr_t *dst)
 
 	err = connect(sock, (struct sockaddr *) &addr, sizeof(addr));
 	if (err < 0 && !(errno == EAGAIN || errno == EINPROGRESS))
-		return err;
+		return -errno;
 
 	return 0;
 }
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH BlueZ] btio: Fix the return value of bt_io functions
  2011-07-05 17:00 [PATCH BlueZ] btio: Fix the return value of bt_io functions Vinicius Costa Gomes
@ 2011-07-09 16:23 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-07-09 16:23 UTC (permalink / raw)
  To: Vinicius Costa Gomes; +Cc: linux-bluetooth

Hi Vinicius,

On Tue, Jul 05, 2011, Vinicius Costa Gomes wrote:
> Some bt_io methods were ignoring the value stored in errno when
> reporting the error to the caller.
> ---
>  btio/btio.c |   15 +++++++++------
>  1 files changed, 9 insertions(+), 6 deletions(-)

Applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-09 16:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-05 17:00 [PATCH BlueZ] btio: Fix the return value of bt_io functions Vinicius Costa Gomes
2011-07-09 16:23 ` Johan Hedberg

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).