[PATCH 2/8] device: Device_remove_stored removes device directory

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

 



When a device is removed we should remove the device info
file and storage directory.
---
 src/device.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/device.c b/src/device.c
index e3570cb..5969f15 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1873,6 +1873,9 @@ static void device_remove_stored(struct btd_device *device)
 {
 	const bdaddr_t *src = adapter_get_address(device->adapter);
 	uint8_t dst_type = device->bdaddr_type;
+	char adapter_addr[18];
+	char device_addr[18];
+	char filename[PATH_MAX + 1];
 
 	delete_entry(src, "profiles", &device->bdaddr, dst_type);
 	delete_entry(src, "trusts", &device->bdaddr, dst_type);
@@ -1893,6 +1896,19 @@ static void device_remove_stored(struct btd_device *device)
 
 	if (device->blocked)
 		device_unblock(device, TRUE, FALSE);
+
+	ba2str(src, adapter_addr);
+	ba2str(&device->bdaddr, device_addr);
+
+	snprintf(filename, PATH_MAX, STORAGEDIR "/%s/%s/info", adapter_addr,
+			device_addr);
+	filename[PATH_MAX] = '\0';
+	remove(filename);
+
+	snprintf(filename, PATH_MAX, STORAGEDIR "/%s/%s", adapter_addr,
+			device_addr);
+	filename[PATH_MAX] = '\0';
+	remove(filename);
 }
 
 void device_remove(struct btd_device *device, gboolean remove_stored)
-- 
1.7.9.5

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