[Bluez PATCH v1 2/2] plugins/admin: create admin_policy_settings if not exists

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

 



From: Yun-Hao Chung <howardchung@xxxxxxxxxxxx>

If admin_policy_settings is not found when loading, we should create one
instead of printing error.

Reviewed-by: Shyh-In Hwang <josephsih@xxxxxxxxxxxx>
Reviewed-by: Miao-chen Chou <mcchou@xxxxxxxxxxxx>
---
This patch has been tested with following steps:
rm /var/lib/bluetooth/admin_policy_settings and restart bluetoothd.
Check if the file is created.

 plugins/admin.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/plugins/admin.c b/plugins/admin.c
index 9440581409fa..fe1d71acbb8f 100644
--- a/plugins/admin.c
+++ b/plugins/admin.c
@@ -67,7 +67,7 @@ static struct btd_admin_policy *admin_policy_new(struct btd_adapter *adapter)
 
 	admin_policy->adapter = adapter;
 	admin_policy->adapter_id = btd_adapter_get_index(adapter);
-	admin_policy->service_allowlist = NULL;
+	admin_policy->service_allowlist = queue_new();
 
 	return admin_policy;
 }
@@ -337,12 +337,8 @@ static void load_policy_settings(struct btd_admin_policy *admin_policy)
 	char *filename = ADMIN_POLICY_STORAGE;
 	struct stat st;
 
-	if (stat(filename, &st) < 0) {
-		btd_error(admin_policy->adapter_id,
-				"Failed to get file %s information",
-				filename);
-		return;
-	}
+	if (stat(filename, &st) < 0)
+		store_policy_settings(policy_data);
 
 	key_file = g_key_file_new();
 
-- 
2.33.0.153.gba50c8fa24-goog




[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