Diff between 95a476ffb081fc82bb01f706976dbaf399c4410b and a29e487d1cb6e70043fe0ec67c94b5a984b7e08c

Changed Files

File Additions Deletions Status
android/hal-health.c +4 -0 modified

Full Patch

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,