linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH_v2] android/hal-health: Fix do not modify fd flags in non connected state
@ 2014-07-03 13:29 Ravi kumar Veeramally
  2014-07-03 13:34 ` Szymon Janc
  0 siblings, 1 reply; 2+ messages in thread
From: Ravi kumar Veeramally @ 2014-07-03 13:29 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ravi kumar Veeramally

Only on BTHL_CONN_STATE_CONNECTED state valid fd will be passed. Other states
fd value is -1. Just call channel status call back.
---
 android/hal-health.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/android/hal-health.c b/android/hal-health.c
index 1ed9fb1..01bc432 100644
--- a/android/hal-health.c
+++ b/android/hal-health.c
@@ -49,6 +49,9 @@ static void handle_channel_state(void *buf, uint16_t len, int fd)
 	struct hal_ev_health_channel_state *ev = buf;
 	int flags;
 
+	if (fd < 0)
+		goto end;
+
 	flags = fcntl(fd, F_GETFL, 0);
 	if (flags < 0) {
 		error("health: fcntl GETFL error: %s", strerror(errno));
@@ -61,6 +64,7 @@ static void handle_channel_state(void *buf, uint16_t len, int fd)
 		return;
 	}
 
+end:
 	if (cbacks->channel_state_cb)
 		cbacks->channel_state_cb(ev->app_id, (bt_bdaddr_t *) ev->bdaddr,
 						ev->mdep_index, ev->channel_id,
-- 
1.9.1


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

* Re: [PATCH_v2] android/hal-health: Fix do not modify fd flags in non connected state
  2014-07-03 13:29 [PATCH_v2] android/hal-health: Fix do not modify fd flags in non connected state Ravi kumar Veeramally
@ 2014-07-03 13:34 ` Szymon Janc
  0 siblings, 0 replies; 2+ messages in thread
From: Szymon Janc @ 2014-07-03 13:34 UTC (permalink / raw)
  To: Ravi kumar Veeramally; +Cc: linux-bluetooth

Hi Ravi,

On Thursday 03 of July 2014 16:29:21 Ravi kumar Veeramally wrote:
> Only on BTHL_CONN_STATE_CONNECTED state valid fd will be passed. Other states
> fd value is -1. Just call channel status call back.
> ---
>  android/hal-health.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/android/hal-health.c b/android/hal-health.c
> index 1ed9fb1..01bc432 100644
> --- a/android/hal-health.c
> +++ b/android/hal-health.c
> @@ -49,6 +49,9 @@ static void handle_channel_state(void *buf, uint16_t len, int fd)
>  	struct hal_ev_health_channel_state *ev = buf;
>  	int flags;
>  
> +	if (fd < 0)
> +		goto end;
> +
>  	flags = fcntl(fd, F_GETFL, 0);
>  	if (flags < 0) {
>  		error("health: fcntl GETFL error: %s", strerror(errno));
> @@ -61,6 +64,7 @@ static void handle_channel_state(void *buf, uint16_t len, int fd)
>  		return;
>  	}
>  
> +end:
>  	if (cbacks->channel_state_cb)
>  		cbacks->channel_state_cb(ev->app_id, (bt_bdaddr_t *) ev->bdaddr,
>  						ev->mdep_index, ev->channel_id,
> 

Patch applied, thanks.

-- 
Best regards, 
Szymon Janc

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

end of thread, other threads:[~2014-07-03 13:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-03 13:29 [PATCH_v2] android/hal-health: Fix do not modify fd flags in non connected state Ravi kumar Veeramally
2014-07-03 13:34 ` Szymon Janc

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