[PATCH_v2] android/hal-health: Fix do not modify fd flags in non connected state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux