summaryrefslogtreecommitdiff
path: root/src/storage.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2011-11-07 11:00:01 -0300
committerJohan Hedberg <johan.hedberg@intel.com>2011-11-14 20:48:12 +0200
commita9e207e5a160e3d0fbfe9fa42beaba8527338031 (patch)
tree139f5070e0f7ed9c79bdf4677c23387a8ae3924e /src/storage.c
parent2878b49b8afcd2b05f355c9f22796bdf06e29c11 (diff)
Remove CCC entries when device is removed
Diffstat (limited to 'src/storage.c')
-rw-r--r--src/storage.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/storage.c b/src/storage.c
index babe7c73..e001987a 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -1195,6 +1195,22 @@ int delete_device_service(const bdaddr_t *sba, const bdaddr_t *dba)
g_slist_free_full(match.keys, g_free);
+ /* Deleting all CCC values of a given address */
+ memset(&match, 0, sizeof(match));
+ match.pattern = address;
+
+ create_filename(filename, PATH_MAX, sba, "ccc");
+ err = textfile_foreach(filename, filter_keys, &match);
+ if (err < 0)
+ return err;
+
+ for (l = match.keys; l; l = l->next) {
+ const char *key = l->data;
+ textfile_del(filename, key);
+ }
+
+ g_slist_free_full(match.keys, g_free);
+
return 0;
}