[PATCH BlueZ v3 18/18] storage: Keep backward compatibility in "aliases" file

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

 



The "aliases" file is shared by both BR/EDR and LE devices, so we must
keep backward compatibility with the old storage format.
---
 src/storage.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/storage.c b/src/storage.c
index 97817cc..3374fc0 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -73,9 +73,17 @@ int read_device_alias(const char *src, const char *dst, uint8_t bdaddr_type,
 	snprintf(key, sizeof(key), "%17s#%hhu", dst, bdaddr_type);
 
 	tmp = textfile_get(filename, key);
-	if (!tmp)
+	if (tmp != NULL)
+		goto done;
+
+	/* Try old format (address only) */
+	key[17] = '\0';
+
+	tmp = textfile_get(filename, key);
+	if (tmp == NULL)
 		return -ENXIO;
 
+done:
 	err = snprintf(alias, size, "%s", tmp);
 
 	free(tmp);
-- 
1.7.7.6

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