summaryrefslogtreecommitdiffstats
path: root/hcid/storage.c
diff options
context:
space:
mode:
Diffstat (limited to 'hcid/storage.c')
-rw-r--r--hcid/storage.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/hcid/storage.c b/hcid/storage.c
index 0d42d680..dad0c366 100644
--- a/hcid/storage.c
+++ b/hcid/storage.c
@@ -219,8 +219,10 @@ int write_device_name(const bdaddr_t *local, const bdaddr_t *peer, const char *n
list_foreach(list, temp) {
ba2str(&temp->bdaddr, addr);
- snprintf(buf, 300, "%s %s\n", addr, temp->data);
- write(fd, buf, strlen(buf));
+ if (temp->data && temp->size > 0) {
+ snprintf(buf, 300, "%s %s\n", addr, temp->data);
+ write(fd, buf, strlen(buf));
+ }
}
unlock:
@@ -294,8 +296,10 @@ int write_link_key(const bdaddr_t *local, const bdaddr_t *peer, const unsigned c
list_foreach(list, temp) {
ba2str(&temp->bdaddr, addr);
- snprintf(buf, 100, "%s %s\n", addr, temp->data);
- write(fd, buf, strlen(buf));
+ if (temp->data && temp->size > 0) {
+ snprintf(buf, 100, "%s %s\n", addr, temp->data);
+ write(fd, buf, strlen(buf));
+ }
}
unlock: