Thread (3 messages) flat view 3 messages, 2 authors, 2021-09-06
STALE1828d REVIEWED: 2 (0M)

2 review trailers.

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

From: Howard Chung <hidden>
Date: 2021-09-06 03:40:18
Subsystem: the rest · Maintainer: Linus Torvalds

From: Yun-Hao Chung <redacted>

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

Reviewed-by: Shyh-In Hwang <redacted>
Reviewed-by: Miao-chen Chou <redacted>
---
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help