From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> This can leave the storage in a bad state if device start changing its attributes the old one are never removed as the code reloads them with g_key_file_load_from_file. --- src/device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/device.c b/src/device.c index 89462ca..14e850e 100644 --- a/src/device.c +++ b/src/device.c @@ -2114,6 +2114,9 @@ static void store_gatt_db(struct btd_device *device) key_file = g_key_file_new(); g_key_file_load_from_file(key_file, filename, 0, NULL); + /* Remove current attributes since it might have changed */ + g_key_file_remove_group(key_file, "Attributes", NULL); + saver.key_file = key_file; saver.device = device; @@ -3082,7 +3085,7 @@ static int load_service(struct gatt_db *db, char *handle, char *value) att = gatt_db_insert_service(db, start, &uuid, primary, end - start + 1); if (!att) { - error("Unable load service into db."); + error("Unable load service into db!"); return -EIO; } -- 2.5.0 -- 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