[PATCH 5/5] Check for existing handle in attrib_db_add()

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

 



This check is necessary to avoid inserting attributes with same handle.
---
 src/attrib-server.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/attrib-server.c b/src/attrib-server.c
index 597a635..74a1c8d 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -1213,10 +1213,12 @@ struct attribute *attrib_db_add(uint16_t handle, bt_uuid_t *uuid, int read_reqs,
 				int write_reqs, const uint8_t *value, int len)
 {
 	struct attribute *a;
+	guint h = handle;
 
 	DBG("handle=0x%04x", handle);
 
-	/* FIXME: handle conflicts */
+	if (g_slist_find_custom(database, GUINT_TO_POINTER(h), handle_cmp))
+		return NULL;
 
 	a = g_malloc0(sizeof(struct attribute) + len);
 	a->handle = handle;
-- 
1.7.0.4

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